@@ -51,6 +51,8 @@ Numeric decoder derived from TCL library
5151#include <numpy/ndarraytypes.h>
5252#include <numpy/npy_math.h>
5353
54+ static const int CSTR_SIZE = 20 ;
55+
5456npy_int64 get_nat (void ) { return NPY_MIN_INT64 ; }
5557
5658typedef const char * (* PFN_PyTypeToUTF8 )(JSOBJ obj , JSONTypeContext * ti ,
@@ -1008,7 +1010,7 @@ static const char *List_iterGetName(JSOBJ Py_UNUSED(obj),
10081010//=============================================================================
10091011static void Index_iterBegin (JSOBJ Py_UNUSED (obj ), JSONTypeContext * tc ) {
10101012 GET_TC (tc )-> index = 0 ;
1011- GET_TC (tc )-> cStr = PyMem_Malloc (20 );
1013+ GET_TC (tc )-> cStr = PyMem_Malloc (CSTR_SIZE );
10121014 if (!GET_TC (tc )-> cStr ) {
10131015 PyErr_NoMemory ();
10141016 }
@@ -1058,7 +1060,7 @@ static void Series_iterBegin(JSOBJ Py_UNUSED(obj), JSONTypeContext *tc) {
10581060 PyObjectEncoder * enc = (PyObjectEncoder * )tc -> encoder ;
10591061 GET_TC (tc )-> index = 0 ;
10601062 enc -> outputFormat = VALUES ; // for contained series
1061- GET_TC (tc )-> cStr = PyMem_Malloc (20 );
1063+ GET_TC (tc )-> cStr = PyMem_Malloc (CSTR_SIZE );
10621064 if (!GET_TC (tc )-> cStr ) {
10631065 PyErr_NoMemory ();
10641066 }
@@ -1113,7 +1115,7 @@ static void DataFrame_iterBegin(JSOBJ Py_UNUSED(obj), JSONTypeContext *tc) {
11131115 PyObjectEncoder * enc = (PyObjectEncoder * )tc -> encoder ;
11141116 GET_TC (tc )-> index = 0 ;
11151117 enc -> outputFormat = VALUES ; // for contained series & index
1116- GET_TC (tc )-> cStr = PyMem_Malloc (20 );
1118+ GET_TC (tc )-> cStr = PyMem_Malloc (CSTR_SIZE );
11171119 if (!GET_TC (tc )-> cStr ) {
11181120 PyErr_NoMemory ();
11191121 }
0 commit comments