Skip to content

Commit 6f8bb9e

Browse files
removed python compatibility (#7206)
* removed python compatibility * add NEWS note --------- Co-authored-by: Benjamin Schwendinger <benjaminschwe@gmail.com>
1 parent ddaeb4c commit 6f8bb9e

5 files changed

Lines changed: 19 additions & 35 deletions

File tree

NEWS.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88

99
1. {data.table} now depends on R 3.5.0 (2018).
1010

11+
2. pydatatable compatibility layer in `fread()` and `fwrite()` has been removed, [#7069](https://github.com/Rdatatable/data.table/issues/7069). Thanks @badasahog for the report and the PR.
12+
1113
### BUG FIXES
1214

1315
1. `fread()` with `skip=0` and `(header=TRUE|FALSE)` no longer skips the first row when it has fewer fields than subsequent rows, [#7463](https://github.com/Rdatatable/data.table/issues/7463). Thanks @emayerhofer for the report and @ben-schwen for the fix.

src/fread.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2502,10 +2502,8 @@ int freadMain(freadMainArgs _args)
25022502
.threadn = me,
25032503
.quoteRule = quoteRule,
25042504
.stopTeam = &stopTeam,
2505-
#ifndef DTPY
25062505
.nStringCols = nStringCols,
25072506
.nNonStringCols = nNonStringCols
2508-
#endif
25092507
};
25102508
if ((rowSize8 && !ctx.buff8) || (rowSize4 && !ctx.buff4) || (rowSize1 && !ctx.buff1)) {
25112509
stopTeam = true;

src/fread.h

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,11 @@
55
#include <stdlib.h> // size_t
66
#include <stdbool.h> // bool
77
#include "myomp.h"
8-
#ifdef DTPY
9-
#include "py_fread.h"
10-
#define ENC2NATIVE(s) (s)
11-
#else
12-
#include "freadR.h"
13-
extern cetype_t ienc;
14-
// R's message functions only take C's char pointer not SEXP, where encoding info can't be stored
15-
// so must convert the error message char to native encoding first in order to correctly display in R
16-
#define ENC2NATIVE(s) translateChar(mkCharCE(s, ienc))
17-
#endif
8+
#include "freadR.h"
9+
extern cetype_t ienc;
10+
// R's message functions only take C's char pointer not SEXP, where encoding info can't be stored
11+
// so must convert the error message char to native encoding first in order to correctly display in R
12+
#define ENC2NATIVE(s) translateChar(mkCharCE(s, ienc))
1813

1914
// Ordered hierarchy of types
2015
// Each of these corresponds to a parser; they must be ordered "preferentially", i.e., if the same
@@ -177,7 +172,7 @@ typedef struct freadMainArgs
177172
char _padding[1];
178173

179174
// Any additional implementation-specific parameters.
180-
FREAD_MAIN_ARGS_EXTRA_FIELDS
175+
bool oldNoDateTime;
181176

182177
} freadMainArgs;
183178

@@ -223,8 +218,8 @@ typedef struct ThreadLocalFreadParsingContext
223218

224219
int quoteRule;
225220

226-
// Any additional implementation-specific parameters.
227-
FREAD_PUSH_BUFFERS_EXTRA_FIELDS
221+
int nStringCols;
222+
int nNonStringCols;
228223

229224
} ThreadLocalFreadParsingContext;
230225

src/freadR.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,6 @@
77
#include <Rinternals.h>
88
#include "po.h"
99

10-
#define FREAD_MAIN_ARGS_EXTRA_FIELDS \
11-
bool oldNoDateTime;
12-
13-
#define FREAD_PUSH_BUFFERS_EXTRA_FIELDS \
14-
int nStringCols; \
15-
int nNonStringCols;
16-
1710
// Before error() [or warning() with options(warn=2)] call freadCleanup() to close mmp and fix :
1811
// http://stackoverflow.com/questions/18597123/fread-data-table-locks-files
1912
// However, msg has to be manually constructed first (rather than simply leaving construction to snprintf inside warning()

src/fwrite.h

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,13 @@
1-
#ifdef DTPY
2-
#include "py_fread.h"
3-
#else
4-
#ifndef STRICT_R_HEADERS
5-
#define STRICT_R_HEADERS
6-
#endif
7-
#include <R.h>
8-
#include <Rinternals.h> // for SEXP in writeList() prototype
9-
#include "po.h"
10-
#define STOP error
11-
#define DTPRINT Rprintf
12-
static char internal_error_buff[256] __attribute__((unused)); // todo: fix imports such that compiler warns correctly #6468
13-
#define INTERNAL_STOP(...) do {snprintf(internal_error_buff, sizeof(internal_error_buff), __VA_ARGS__); error("%s %s: %s. %s", _("Internal error in"), __func__, internal_error_buff, _("Please report to the data.table issues tracker"));} while (0)
1+
#ifndef STRICT_R_HEADERS
2+
#define STRICT_R_HEADERS
143
#endif
4+
#include <R.h>
5+
#include <Rinternals.h> // for SEXP in writeList() prototype
6+
#include "po.h"
7+
#define STOP error
8+
#define DTPRINT Rprintf
9+
static char internal_error_buff[256] __attribute__((unused)); // todo: fix imports such that compiler warns correctly #6468
10+
#define INTERNAL_STOP(...) do {snprintf(internal_error_buff, sizeof(internal_error_buff), __VA_ARGS__); error("%s %s: %s. %s", _("Internal error in"), __func__, internal_error_buff, _("Please report to the data.table issues tracker"));} while (0)
1511

1612
typedef void writer_fun_t(const void *, int64_t, char **);
1713

0 commit comments

Comments
 (0)