From cd6b630ca973fb8f14e3344bc072c69f008ac2b1 Mon Sep 17 00:00:00 2001 From: Will Ayd Date: Fri, 18 Nov 2022 12:59:08 -0800 Subject: [PATCH 01/13] removed GNU extension from JSON --- pandas/_libs/src/ujson/lib/ultrajsondec.c | 15 +-------------- pandas/_libs/src/ujson/lib/ultrajsonenc.c | 16 +--------------- setup.py | 2 +- 3 files changed, 3 insertions(+), 30 deletions(-) diff --git a/pandas/_libs/src/ujson/lib/ultrajsondec.c b/pandas/_libs/src/ujson/lib/ultrajsondec.c index c7779b8b428ae..c1d4e7db621e3 100644 --- a/pandas/_libs/src/ujson/lib/ultrajsondec.c +++ b/pandas/_libs/src/ujson/lib/ultrajsondec.c @@ -1154,7 +1154,6 @@ JSOBJ JSON_DecodeObject(JSONObjectDecoder *dec, const char *buffer, /* FIXME: Base the size of escBuffer of that of cbBuffer so that the unicode escaping doesn't run into the wall each time */ - char *locale; struct DecoderState ds; wchar_t escBuffer[(JSON_MAX_STACK_BUFFER_SIZE / sizeof(wchar_t))]; JSOBJ ret; @@ -1173,19 +1172,7 @@ JSOBJ JSON_DecodeObject(JSONObjectDecoder *dec, const char *buffer, ds.dec = dec; - locale = setlocale(LC_NUMERIC, NULL); - if (strcmp(locale, "C")) { - locale = strdup(locale); - if (!locale) { - return SetError(&ds, -1, "Could not reserve memory block"); - } - setlocale(LC_NUMERIC, "C"); - ret = decode_any(&ds); - setlocale(LC_NUMERIC, locale); - free(locale); - } else { - ret = decode_any(&ds); - } + ret = decode_any(&ds); if (ds.escHeap) { dec->free(ds.escStart); diff --git a/pandas/_libs/src/ujson/lib/ultrajsonenc.c b/pandas/_libs/src/ujson/lib/ultrajsonenc.c index 5d90710441a94..cf1f9edcc5e66 100644 --- a/pandas/_libs/src/ujson/lib/ultrajsonenc.c +++ b/pandas/_libs/src/ujson/lib/ultrajsonenc.c @@ -1142,7 +1142,6 @@ void encode(JSOBJ obj, JSONObjectEncoder *enc, const char *name, char *JSON_EncodeObject(JSOBJ obj, JSONObjectEncoder *enc, char *_buffer, size_t _cbBuffer) { - char *locale; enc->malloc = enc->malloc ? enc->malloc : malloc; enc->free = enc->free ? enc->free : free; enc->realloc = enc->realloc ? enc->realloc : realloc; @@ -1175,20 +1174,7 @@ char *JSON_EncodeObject(JSOBJ obj, JSONObjectEncoder *enc, char *_buffer, enc->end = enc->start + _cbBuffer; enc->offset = enc->start; - locale = setlocale(LC_NUMERIC, NULL); - if (strcmp(locale, "C")) { - locale = strdup(locale); - if (!locale) { - SetError(NULL, enc, "Could not reserve memory block"); - return NULL; - } - setlocale(LC_NUMERIC, "C"); - encode(obj, enc, NULL, 0); - setlocale(LC_NUMERIC, locale); - free(locale); - } else { - encode(obj, enc, NULL, 0); - } + encode(obj, enc, NULL, 0); Buffer_Reserve(enc, 1); if (enc->errorMsg) { diff --git a/setup.py b/setup.py index 05d4407c7e959..02b91cbb0d9b4 100755 --- a/setup.py +++ b/setup.py @@ -649,7 +649,7 @@ def srcpath(name=None, suffix=".pyx", subdir="src"): "pandas/_libs/src/datetime", numpy.get_include(), ], - extra_compile_args=(["-D_GNU_SOURCE"] + extra_compile_args), + extra_compile_args=(extra_compile_args), extra_link_args=extra_link_args, define_macros=macros, ) From 13012cad51501dd742a505a0e06ba9f29974a2e0 Mon Sep 17 00:00:00 2001 From: Will Ayd Date: Fri, 18 Nov 2022 17:17:24 -0800 Subject: [PATCH 02/13] Revert "removed GNU extension from JSON" This reverts commit cd6b630ca973fb8f14e3344bc072c69f008ac2b1. --- pandas/_libs/src/ujson/lib/ultrajsondec.c | 15 ++++++++++++++- pandas/_libs/src/ujson/lib/ultrajsonenc.c | 16 +++++++++++++++- setup.py | 2 +- 3 files changed, 30 insertions(+), 3 deletions(-) diff --git a/pandas/_libs/src/ujson/lib/ultrajsondec.c b/pandas/_libs/src/ujson/lib/ultrajsondec.c index c1d4e7db621e3..c7779b8b428ae 100644 --- a/pandas/_libs/src/ujson/lib/ultrajsondec.c +++ b/pandas/_libs/src/ujson/lib/ultrajsondec.c @@ -1154,6 +1154,7 @@ JSOBJ JSON_DecodeObject(JSONObjectDecoder *dec, const char *buffer, /* FIXME: Base the size of escBuffer of that of cbBuffer so that the unicode escaping doesn't run into the wall each time */ + char *locale; struct DecoderState ds; wchar_t escBuffer[(JSON_MAX_STACK_BUFFER_SIZE / sizeof(wchar_t))]; JSOBJ ret; @@ -1172,7 +1173,19 @@ JSOBJ JSON_DecodeObject(JSONObjectDecoder *dec, const char *buffer, ds.dec = dec; - ret = decode_any(&ds); + locale = setlocale(LC_NUMERIC, NULL); + if (strcmp(locale, "C")) { + locale = strdup(locale); + if (!locale) { + return SetError(&ds, -1, "Could not reserve memory block"); + } + setlocale(LC_NUMERIC, "C"); + ret = decode_any(&ds); + setlocale(LC_NUMERIC, locale); + free(locale); + } else { + ret = decode_any(&ds); + } if (ds.escHeap) { dec->free(ds.escStart); diff --git a/pandas/_libs/src/ujson/lib/ultrajsonenc.c b/pandas/_libs/src/ujson/lib/ultrajsonenc.c index cf1f9edcc5e66..5d90710441a94 100644 --- a/pandas/_libs/src/ujson/lib/ultrajsonenc.c +++ b/pandas/_libs/src/ujson/lib/ultrajsonenc.c @@ -1142,6 +1142,7 @@ void encode(JSOBJ obj, JSONObjectEncoder *enc, const char *name, char *JSON_EncodeObject(JSOBJ obj, JSONObjectEncoder *enc, char *_buffer, size_t _cbBuffer) { + char *locale; enc->malloc = enc->malloc ? enc->malloc : malloc; enc->free = enc->free ? enc->free : free; enc->realloc = enc->realloc ? enc->realloc : realloc; @@ -1174,7 +1175,20 @@ char *JSON_EncodeObject(JSOBJ obj, JSONObjectEncoder *enc, char *_buffer, enc->end = enc->start + _cbBuffer; enc->offset = enc->start; - encode(obj, enc, NULL, 0); + locale = setlocale(LC_NUMERIC, NULL); + if (strcmp(locale, "C")) { + locale = strdup(locale); + if (!locale) { + SetError(NULL, enc, "Could not reserve memory block"); + return NULL; + } + setlocale(LC_NUMERIC, "C"); + encode(obj, enc, NULL, 0); + setlocale(LC_NUMERIC, locale); + free(locale); + } else { + encode(obj, enc, NULL, 0); + } Buffer_Reserve(enc, 1); if (enc->errorMsg) { diff --git a/setup.py b/setup.py index 02b91cbb0d9b4..05d4407c7e959 100755 --- a/setup.py +++ b/setup.py @@ -649,7 +649,7 @@ def srcpath(name=None, suffix=".pyx", subdir="src"): "pandas/_libs/src/datetime", numpy.get_include(), ], - extra_compile_args=(extra_compile_args), + extra_compile_args=(["-D_GNU_SOURCE"] + extra_compile_args), extra_link_args=extra_link_args, define_macros=macros, ) From 9e34c2a19769d5819c8480ce9a20505064336f62 Mon Sep 17 00:00:00 2001 From: Will Ayd Date: Fri, 18 Nov 2022 17:22:38 -0800 Subject: [PATCH 03/13] try again --- pandas/_libs/src/headers/portable.h | 6 ------ pandas/_libs/src/ujson/lib/ultrajsondec.c | 9 ++++----- pandas/_libs/src/ujson/lib/ultrajsonenc.c | 11 +++++------ setup.py | 2 +- 4 files changed, 10 insertions(+), 18 deletions(-) diff --git a/pandas/_libs/src/headers/portable.h b/pandas/_libs/src/headers/portable.h index 3464fba963a5e..91b4702d32452 100644 --- a/pandas/_libs/src/headers/portable.h +++ b/pandas/_libs/src/headers/portable.h @@ -1,16 +1,10 @@ #ifndef _PANDAS_PORTABLE_H_ #define _PANDAS_PORTABLE_H_ -// To get `strdup` from strings.h -#ifndef _XOPEN_SOURCE -#define _XOPEN_SOURCE 600 -#endif - #include #if defined(_MSC_VER) #define strcasecmp( s1, s2 ) _stricmp( s1, s2 ) -#define strdup _strdup #endif // GH-23516 - works around locale perf issues diff --git a/pandas/_libs/src/ujson/lib/ultrajsondec.c b/pandas/_libs/src/ujson/lib/ultrajsondec.c index c7779b8b428ae..32a49011db7ee 100644 --- a/pandas/_libs/src/ujson/lib/ultrajsondec.c +++ b/pandas/_libs/src/ujson/lib/ultrajsondec.c @@ -1174,15 +1174,14 @@ JSOBJ JSON_DecodeObject(JSONObjectDecoder *dec, const char *buffer, ds.dec = dec; locale = setlocale(LC_NUMERIC, NULL); + if (!locale) { + return SetError(&ds, -1, "Could not reserve memory block"); + } + if (strcmp(locale, "C")) { - locale = strdup(locale); - if (!locale) { - return SetError(&ds, -1, "Could not reserve memory block"); - } setlocale(LC_NUMERIC, "C"); ret = decode_any(&ds); setlocale(LC_NUMERIC, locale); - free(locale); } else { ret = decode_any(&ds); } diff --git a/pandas/_libs/src/ujson/lib/ultrajsonenc.c b/pandas/_libs/src/ujson/lib/ultrajsonenc.c index 5d90710441a94..d42b532ca9c06 100644 --- a/pandas/_libs/src/ujson/lib/ultrajsonenc.c +++ b/pandas/_libs/src/ujson/lib/ultrajsonenc.c @@ -1176,16 +1176,15 @@ char *JSON_EncodeObject(JSOBJ obj, JSONObjectEncoder *enc, char *_buffer, enc->offset = enc->start; locale = setlocale(LC_NUMERIC, NULL); + if (!locale) { + SetError(NULL, enc, "Could not reserve memory block"); + return NULL; + } + if (strcmp(locale, "C")) { - locale = strdup(locale); - if (!locale) { - SetError(NULL, enc, "Could not reserve memory block"); - return NULL; - } setlocale(LC_NUMERIC, "C"); encode(obj, enc, NULL, 0); setlocale(LC_NUMERIC, locale); - free(locale); } else { encode(obj, enc, NULL, 0); } diff --git a/setup.py b/setup.py index 05d4407c7e959..02b91cbb0d9b4 100755 --- a/setup.py +++ b/setup.py @@ -649,7 +649,7 @@ def srcpath(name=None, suffix=".pyx", subdir="src"): "pandas/_libs/src/datetime", numpy.get_include(), ], - extra_compile_args=(["-D_GNU_SOURCE"] + extra_compile_args), + extra_compile_args=(extra_compile_args), extra_link_args=extra_link_args, define_macros=macros, ) From 847fee600edce919975e740ebd7686cdc37aa6a0 Mon Sep 17 00:00:00 2001 From: Will Ayd Date: Mon, 21 Nov 2022 08:25:07 -0800 Subject: [PATCH 04/13] Better setlocale error --- pandas/_libs/src/ujson/lib/ultrajsondec.c | 2 +- pandas/_libs/src/ujson/lib/ultrajsonenc.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pandas/_libs/src/ujson/lib/ultrajsondec.c b/pandas/_libs/src/ujson/lib/ultrajsondec.c index 32a49011db7ee..90391536b143b 100644 --- a/pandas/_libs/src/ujson/lib/ultrajsondec.c +++ b/pandas/_libs/src/ujson/lib/ultrajsondec.c @@ -1175,7 +1175,7 @@ JSOBJ JSON_DecodeObject(JSONObjectDecoder *dec, const char *buffer, locale = setlocale(LC_NUMERIC, NULL); if (!locale) { - return SetError(&ds, -1, "Could not reserve memory block"); + return SetError(&ds, -1, "setlocale call failed"); } if (strcmp(locale, "C")) { diff --git a/pandas/_libs/src/ujson/lib/ultrajsonenc.c b/pandas/_libs/src/ujson/lib/ultrajsonenc.c index d42b532ca9c06..a7c590f97635e 100644 --- a/pandas/_libs/src/ujson/lib/ultrajsonenc.c +++ b/pandas/_libs/src/ujson/lib/ultrajsonenc.c @@ -1177,7 +1177,7 @@ char *JSON_EncodeObject(JSOBJ obj, JSONObjectEncoder *enc, char *_buffer, locale = setlocale(LC_NUMERIC, NULL); if (!locale) { - SetError(NULL, enc, "Could not reserve memory block"); + SetError(NULL, enc, "setlocale call failed"); return NULL; } From 73aaceaf3192a9075fea8db65ae83c98396d6b94 Mon Sep 17 00:00:00 2001 From: Will Ayd Date: Mon, 21 Nov 2022 10:59:09 -0800 Subject: [PATCH 05/13] Copied string --- pandas/_libs/src/ujson/lib/ultrajsondec.c | 9 ++++++++- pandas/_libs/src/ujson/lib/ultrajsonenc.c | 10 +++++++++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/pandas/_libs/src/ujson/lib/ultrajsondec.c b/pandas/_libs/src/ujson/lib/ultrajsondec.c index 90391536b143b..54d128f86fa93 100644 --- a/pandas/_libs/src/ujson/lib/ultrajsondec.c +++ b/pandas/_libs/src/ujson/lib/ultrajsondec.c @@ -1179,9 +1179,16 @@ JSOBJ JSON_DecodeObject(JSONObjectDecoder *dec, const char *buffer, } if (strcmp(locale, "C")) { + int len = strlen(locale) + 1; + char *origLocale = malloc(len); + if (origLocale == NULL) { + return SetError(&ds, -1, "Could not reserve memory block"); + } + strncpy(origLocale, locale, len); setlocale(LC_NUMERIC, "C"); ret = decode_any(&ds); - setlocale(LC_NUMERIC, locale); + setlocale(LC_NUMERIC, origLocale); + free(locale); } else { ret = decode_any(&ds); } diff --git a/pandas/_libs/src/ujson/lib/ultrajsonenc.c b/pandas/_libs/src/ujson/lib/ultrajsonenc.c index a7c590f97635e..7a457ccab3301 100644 --- a/pandas/_libs/src/ujson/lib/ultrajsonenc.c +++ b/pandas/_libs/src/ujson/lib/ultrajsonenc.c @@ -1182,9 +1182,17 @@ char *JSON_EncodeObject(JSOBJ obj, JSONObjectEncoder *enc, char *_buffer, } if (strcmp(locale, "C")) { + int len = strlen(locale) + 1; + char *origLocale = malloc(len); + if (origLocale == NULL) { + SetError(NULL, enc, "Could not reserve memory block"); + return NULL; + } + strncpy(origLocale, locale, len); setlocale(LC_NUMERIC, "C"); encode(obj, enc, NULL, 0); - setlocale(LC_NUMERIC, locale); + setlocale(LC_NUMERIC, origLocale); + free(origLocale); } else { encode(obj, enc, NULL, 0); } From 08361198b65b5479d34de8c10f947f0f32204c40 Mon Sep 17 00:00:00 2001 From: Will Ayd Date: Mon, 21 Nov 2022 11:38:58 -0800 Subject: [PATCH 06/13] make cpplint happy --- pandas/_libs/src/ujson/lib/ultrajsondec.c | 2 +- pandas/_libs/src/ujson/lib/ultrajsonenc.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pandas/_libs/src/ujson/lib/ultrajsondec.c b/pandas/_libs/src/ujson/lib/ultrajsondec.c index 54d128f86fa93..34e61f3b05e29 100644 --- a/pandas/_libs/src/ujson/lib/ultrajsondec.c +++ b/pandas/_libs/src/ujson/lib/ultrajsondec.c @@ -1184,7 +1184,7 @@ JSOBJ JSON_DecodeObject(JSONObjectDecoder *dec, const char *buffer, if (origLocale == NULL) { return SetError(&ds, -1, "Could not reserve memory block"); } - strncpy(origLocale, locale, len); + snprintf(origLocale, len, "%s", locale); setlocale(LC_NUMERIC, "C"); ret = decode_any(&ds); setlocale(LC_NUMERIC, origLocale); diff --git a/pandas/_libs/src/ujson/lib/ultrajsonenc.c b/pandas/_libs/src/ujson/lib/ultrajsonenc.c index 7a457ccab3301..83e70731c99fa 100644 --- a/pandas/_libs/src/ujson/lib/ultrajsonenc.c +++ b/pandas/_libs/src/ujson/lib/ultrajsonenc.c @@ -1182,13 +1182,13 @@ char *JSON_EncodeObject(JSOBJ obj, JSONObjectEncoder *enc, char *_buffer, } if (strcmp(locale, "C")) { - int len = strlen(locale) + 1; + int len = malloc(strlen(locale) + 1); char *origLocale = malloc(len); if (origLocale == NULL) { SetError(NULL, enc, "Could not reserve memory block"); return NULL; } - strncpy(origLocale, locale, len); + snprintf(origLocale, len, "%s", locale); setlocale(LC_NUMERIC, "C"); encode(obj, enc, NULL, 0); setlocale(LC_NUMERIC, origLocale); From 7682ef60fdfbd89613395b0d506d52ba8d4d06d0 Mon Sep 17 00:00:00 2001 From: Will Ayd Date: Mon, 21 Nov 2022 12:32:44 -0800 Subject: [PATCH 07/13] typo fix --- pandas/_libs/src/ujson/lib/ultrajsonenc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandas/_libs/src/ujson/lib/ultrajsonenc.c b/pandas/_libs/src/ujson/lib/ultrajsonenc.c index 83e70731c99fa..2a1722cdd4ab1 100644 --- a/pandas/_libs/src/ujson/lib/ultrajsonenc.c +++ b/pandas/_libs/src/ujson/lib/ultrajsonenc.c @@ -1182,7 +1182,7 @@ char *JSON_EncodeObject(JSOBJ obj, JSONObjectEncoder *enc, char *_buffer, } if (strcmp(locale, "C")) { - int len = malloc(strlen(locale) + 1); + int len = strlen(locale) + 1; char *origLocale = malloc(len); if (origLocale == NULL) { SetError(NULL, enc, "Could not reserve memory block"); From bfed1d8189cd843b06665edf17dddf03e817c52a Mon Sep 17 00:00:00 2001 From: Will Ayd Date: Mon, 21 Nov 2022 17:46:45 -0800 Subject: [PATCH 08/13] memcpy instead of snprintf --- pandas/_libs/src/ujson/lib/ultrajsondec.c | 4 ++-- pandas/_libs/src/ujson/lib/ultrajsonenc.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pandas/_libs/src/ujson/lib/ultrajsondec.c b/pandas/_libs/src/ujson/lib/ultrajsondec.c index 34e61f3b05e29..627d450b430be 100644 --- a/pandas/_libs/src/ujson/lib/ultrajsondec.c +++ b/pandas/_libs/src/ujson/lib/ultrajsondec.c @@ -1179,12 +1179,12 @@ JSOBJ JSON_DecodeObject(JSONObjectDecoder *dec, const char *buffer, } if (strcmp(locale, "C")) { - int len = strlen(locale) + 1; + size_t len = strlen(locale) + 1; char *origLocale = malloc(len); if (origLocale == NULL) { return SetError(&ds, -1, "Could not reserve memory block"); } - snprintf(origLocale, len, "%s", locale); + memcpy(origLocale, locale, len); setlocale(LC_NUMERIC, "C"); ret = decode_any(&ds); setlocale(LC_NUMERIC, origLocale); diff --git a/pandas/_libs/src/ujson/lib/ultrajsonenc.c b/pandas/_libs/src/ujson/lib/ultrajsonenc.c index 2a1722cdd4ab1..886d3a9d75240 100644 --- a/pandas/_libs/src/ujson/lib/ultrajsonenc.c +++ b/pandas/_libs/src/ujson/lib/ultrajsonenc.c @@ -1182,13 +1182,13 @@ char *JSON_EncodeObject(JSOBJ obj, JSONObjectEncoder *enc, char *_buffer, } if (strcmp(locale, "C")) { - int len = strlen(locale) + 1; + size_t len = strlen(locale) + 1; char *origLocale = malloc(len); if (origLocale == NULL) { SetError(NULL, enc, "Could not reserve memory block"); return NULL; } - snprintf(origLocale, len, "%s", locale); + memcpy(origLocale, locale, len); setlocale(LC_NUMERIC, "C"); encode(obj, enc, NULL, 0); setlocale(LC_NUMERIC, origLocale); From a6199a87eeda88b2da2d797ec651d5fc2834f69b Mon Sep 17 00:00:00 2001 From: Will Ayd Date: Mon, 21 Nov 2022 18:21:56 -0800 Subject: [PATCH 09/13] try catchsegv --- .github/workflows/docbuild-and-upload.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docbuild-and-upload.yml b/.github/workflows/docbuild-and-upload.yml index 1db8fb9a70254..ddac88b02a5d5 100644 --- a/.github/workflows/docbuild-and-upload.yml +++ b/.github/workflows/docbuild-and-upload.yml @@ -49,7 +49,7 @@ jobs: run: python web/pandas_web.py web/pandas --target-path=web/build - name: Build documentation - run: doc/make.py --warnings-are-errors + run: catchsegv doc/make.py --warnings-are-errors - name: Build documentation zip run: doc/make.py zip_html From c9f5225881e4d2fbabe8f38f5e02196e8f01ad52 Mon Sep 17 00:00:00 2001 From: Will Ayd Date: Mon, 21 Nov 2022 19:18:29 -0800 Subject: [PATCH 10/13] single doc build --- doc/make.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/make.py b/doc/make.py index f5bf170c6274d..3d19199968974 100755 --- a/doc/make.py +++ b/doc/make.py @@ -362,7 +362,7 @@ def main(): os.environ["MPLBACKEND"] = "module://matplotlib.backends.backend_agg" builder = DocBuilder( - args.num_jobs, + 1, not args.no_api, args.whatsnew, args.single, From e2d30c228b108ee4e95932a08a5df328408ef6c0 Mon Sep 17 00:00:00 2001 From: Will Ayd Date: Mon, 21 Nov 2022 20:30:12 -0800 Subject: [PATCH 11/13] Revert "single doc build" This reverts commit c9f5225881e4d2fbabe8f38f5e02196e8f01ad52. --- doc/make.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/make.py b/doc/make.py index 3d19199968974..f5bf170c6274d 100755 --- a/doc/make.py +++ b/doc/make.py @@ -362,7 +362,7 @@ def main(): os.environ["MPLBACKEND"] = "module://matplotlib.backends.backend_agg" builder = DocBuilder( - 1, + args.num_jobs, not args.no_api, args.whatsnew, args.single, From 6a42c35bfdf2039819bac03816f1057e7125c2a5 Mon Sep 17 00:00:00 2001 From: Will Ayd Date: Mon, 21 Nov 2022 20:30:16 -0800 Subject: [PATCH 12/13] Revert "try catchsegv" This reverts commit a6199a87eeda88b2da2d797ec651d5fc2834f69b. --- .github/workflows/docbuild-and-upload.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docbuild-and-upload.yml b/.github/workflows/docbuild-and-upload.yml index ddac88b02a5d5..1db8fb9a70254 100644 --- a/.github/workflows/docbuild-and-upload.yml +++ b/.github/workflows/docbuild-and-upload.yml @@ -49,7 +49,7 @@ jobs: run: python web/pandas_web.py web/pandas --target-path=web/build - name: Build documentation - run: catchsegv doc/make.py --warnings-are-errors + run: doc/make.py --warnings-are-errors - name: Build documentation zip run: doc/make.py zip_html From aef29afff461156f00cb21365a0cd43c5cbcae55 Mon Sep 17 00:00:00 2001 From: Will Ayd Date: Mon, 21 Nov 2022 20:32:07 -0800 Subject: [PATCH 13/13] Fixed wrong free --- pandas/_libs/src/ujson/lib/ultrajsondec.c | 10 +++++----- pandas/_libs/src/ujson/lib/ultrajsonenc.c | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/pandas/_libs/src/ujson/lib/ultrajsondec.c b/pandas/_libs/src/ujson/lib/ultrajsondec.c index 627d450b430be..5347db1655669 100644 --- a/pandas/_libs/src/ujson/lib/ultrajsondec.c +++ b/pandas/_libs/src/ujson/lib/ultrajsondec.c @@ -1180,15 +1180,15 @@ JSOBJ JSON_DecodeObject(JSONObjectDecoder *dec, const char *buffer, if (strcmp(locale, "C")) { size_t len = strlen(locale) + 1; - char *origLocale = malloc(len); - if (origLocale == NULL) { + char *saved_locale = malloc(len); + if (saved_locale == NULL) { return SetError(&ds, -1, "Could not reserve memory block"); } - memcpy(origLocale, locale, len); + memcpy(saved_locale, locale, len); setlocale(LC_NUMERIC, "C"); ret = decode_any(&ds); - setlocale(LC_NUMERIC, origLocale); - free(locale); + setlocale(LC_NUMERIC, saved_locale); + free(saved_locale); } else { ret = decode_any(&ds); } diff --git a/pandas/_libs/src/ujson/lib/ultrajsonenc.c b/pandas/_libs/src/ujson/lib/ultrajsonenc.c index 886d3a9d75240..a74d505b0d0ec 100644 --- a/pandas/_libs/src/ujson/lib/ultrajsonenc.c +++ b/pandas/_libs/src/ujson/lib/ultrajsonenc.c @@ -1183,16 +1183,16 @@ char *JSON_EncodeObject(JSOBJ obj, JSONObjectEncoder *enc, char *_buffer, if (strcmp(locale, "C")) { size_t len = strlen(locale) + 1; - char *origLocale = malloc(len); - if (origLocale == NULL) { + char *saved_locale = malloc(len); + if (saved_locale == NULL) { SetError(NULL, enc, "Could not reserve memory block"); return NULL; } - memcpy(origLocale, locale, len); + memcpy(saved_locale, locale, len); setlocale(LC_NUMERIC, "C"); encode(obj, enc, NULL, 0); - setlocale(LC_NUMERIC, origLocale); - free(origLocale); + setlocale(LC_NUMERIC, saved_locale); + free(saved_locale); } else { encode(obj, enc, NULL, 0); }