Skip to content

Commit cd6b630

Browse files
committed
removed GNU extension from JSON
1 parent fdb917f commit cd6b630

File tree

3 files changed

+3
-30
lines changed

3 files changed

+3
-30
lines changed

pandas/_libs/src/ujson/lib/ultrajsondec.c

+1-14
Original file line numberDiff line numberDiff line change
@@ -1154,7 +1154,6 @@ JSOBJ JSON_DecodeObject(JSONObjectDecoder *dec, const char *buffer,
11541154
/*
11551155
FIXME: Base the size of escBuffer of that of cbBuffer so that the unicode
11561156
escaping doesn't run into the wall each time */
1157-
char *locale;
11581157
struct DecoderState ds;
11591158
wchar_t escBuffer[(JSON_MAX_STACK_BUFFER_SIZE / sizeof(wchar_t))];
11601159
JSOBJ ret;
@@ -1173,19 +1172,7 @@ JSOBJ JSON_DecodeObject(JSONObjectDecoder *dec, const char *buffer,
11731172

11741173
ds.dec = dec;
11751174

1176-
locale = setlocale(LC_NUMERIC, NULL);
1177-
if (strcmp(locale, "C")) {
1178-
locale = strdup(locale);
1179-
if (!locale) {
1180-
return SetError(&ds, -1, "Could not reserve memory block");
1181-
}
1182-
setlocale(LC_NUMERIC, "C");
1183-
ret = decode_any(&ds);
1184-
setlocale(LC_NUMERIC, locale);
1185-
free(locale);
1186-
} else {
1187-
ret = decode_any(&ds);
1188-
}
1175+
ret = decode_any(&ds);
11891176

11901177
if (ds.escHeap) {
11911178
dec->free(ds.escStart);

pandas/_libs/src/ujson/lib/ultrajsonenc.c

+1-15
Original file line numberDiff line numberDiff line change
@@ -1142,7 +1142,6 @@ void encode(JSOBJ obj, JSONObjectEncoder *enc, const char *name,
11421142

11431143
char *JSON_EncodeObject(JSOBJ obj, JSONObjectEncoder *enc, char *_buffer,
11441144
size_t _cbBuffer) {
1145-
char *locale;
11461145
enc->malloc = enc->malloc ? enc->malloc : malloc;
11471146
enc->free = enc->free ? enc->free : free;
11481147
enc->realloc = enc->realloc ? enc->realloc : realloc;
@@ -1175,20 +1174,7 @@ char *JSON_EncodeObject(JSOBJ obj, JSONObjectEncoder *enc, char *_buffer,
11751174
enc->end = enc->start + _cbBuffer;
11761175
enc->offset = enc->start;
11771176

1178-
locale = setlocale(LC_NUMERIC, NULL);
1179-
if (strcmp(locale, "C")) {
1180-
locale = strdup(locale);
1181-
if (!locale) {
1182-
SetError(NULL, enc, "Could not reserve memory block");
1183-
return NULL;
1184-
}
1185-
setlocale(LC_NUMERIC, "C");
1186-
encode(obj, enc, NULL, 0);
1187-
setlocale(LC_NUMERIC, locale);
1188-
free(locale);
1189-
} else {
1190-
encode(obj, enc, NULL, 0);
1191-
}
1177+
encode(obj, enc, NULL, 0);
11921178

11931179
Buffer_Reserve(enc, 1);
11941180
if (enc->errorMsg) {

setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -649,7 +649,7 @@ def srcpath(name=None, suffix=".pyx", subdir="src"):
649649
"pandas/_libs/src/datetime",
650650
numpy.get_include(),
651651
],
652-
extra_compile_args=(["-D_GNU_SOURCE"] + extra_compile_args),
652+
extra_compile_args=(extra_compile_args),
653653
extra_link_args=extra_link_args,
654654
define_macros=macros,
655655
)

0 commit comments

Comments
 (0)