Skip to content

Commit 9e34c2a

Browse files
committed
try again
1 parent 13012ca commit 9e34c2a

File tree

4 files changed

+10
-18
lines changed

4 files changed

+10
-18
lines changed

pandas/_libs/src/headers/portable.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,10 @@
11
#ifndef _PANDAS_PORTABLE_H_
22
#define _PANDAS_PORTABLE_H_
33

4-
// To get `strdup` from strings.h
5-
#ifndef _XOPEN_SOURCE
6-
#define _XOPEN_SOURCE 600
7-
#endif
8-
94
#include <string.h>
105

116
#if defined(_MSC_VER)
127
#define strcasecmp( s1, s2 ) _stricmp( s1, s2 )
13-
#define strdup _strdup
148
#endif
159

1610
// GH-23516 - works around locale perf issues

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

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1174,15 +1174,14 @@ JSOBJ JSON_DecodeObject(JSONObjectDecoder *dec, const char *buffer,
11741174
ds.dec = dec;
11751175

11761176
locale = setlocale(LC_NUMERIC, NULL);
1177+
if (!locale) {
1178+
return SetError(&ds, -1, "Could not reserve memory block");
1179+
}
1180+
11771181
if (strcmp(locale, "C")) {
1178-
locale = strdup(locale);
1179-
if (!locale) {
1180-
return SetError(&ds, -1, "Could not reserve memory block");
1181-
}
11821182
setlocale(LC_NUMERIC, "C");
11831183
ret = decode_any(&ds);
11841184
setlocale(LC_NUMERIC, locale);
1185-
free(locale);
11861185
} else {
11871186
ret = decode_any(&ds);
11881187
}

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

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1176,16 +1176,15 @@ char *JSON_EncodeObject(JSOBJ obj, JSONObjectEncoder *enc, char *_buffer,
11761176
enc->offset = enc->start;
11771177

11781178
locale = setlocale(LC_NUMERIC, NULL);
1179+
if (!locale) {
1180+
SetError(NULL, enc, "Could not reserve memory block");
1181+
return NULL;
1182+
}
1183+
11791184
if (strcmp(locale, "C")) {
1180-
locale = strdup(locale);
1181-
if (!locale) {
1182-
SetError(NULL, enc, "Could not reserve memory block");
1183-
return NULL;
1184-
}
11851185
setlocale(LC_NUMERIC, "C");
11861186
encode(obj, enc, NULL, 0);
11871187
setlocale(LC_NUMERIC, locale);
1188-
free(locale);
11891188
} else {
11901189
encode(obj, enc, NULL, 0);
11911190
}

setup.py

Lines changed: 1 addition & 1 deletion
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)