File tree 2 files changed +6
-3
lines changed
pandas/_libs/src/ujson/python
2 files changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -35,11 +35,13 @@ Numeric decoder derived from from TCL library
35
35
* Copyright (c) 1988-1993 The Regents of the University of California.
36
36
* Copyright (c) 1994 Sun Microsystems, Inc.
37
37
*/
38
- #define PY_ARRAY_UNIQUE_SYMBOL UJSON_NUMPY
39
38
40
39
#define PY_SSIZE_T_CLEAN
41
40
#include <Python.h>
42
41
#include <math.h>
42
+
43
+ #define NO_IMPORT_ARRAY
44
+ #define PY_ARRAY_UNIQUE_SYMBOL UJSON_NUMPY
43
45
#include <numpy/arrayobject.h>
44
46
#include <numpy/arrayscalars.h>
45
47
#include <numpy/ndarraytypes.h>
@@ -178,8 +180,6 @@ void *initObjToJSON(void) {
178
180
Py_DECREF (mod_natype );
179
181
}
180
182
181
- /* Initialise numpy API */
182
- import_array ();
183
183
// GH 31463
184
184
return NULL ;
185
185
}
Original file line number Diff line number Diff line change @@ -38,6 +38,8 @@ Numeric decoder derived from from TCL library
38
38
#include "version.h"
39
39
#define PY_SSIZE_T_CLEAN
40
40
#include <Python.h>
41
+ #define PY_ARRAY_UNIQUE_SYMBOL UJSON_NUMPY
42
+ #include "numpy/arrayobject.h"
41
43
42
44
/* objToJSON */
43
45
PyObject * objToJSON (PyObject * self , PyObject * args , PyObject * kwargs );
@@ -73,6 +75,7 @@ static PyModuleDef moduledef = {
73
75
74
76
75
77
PyMODINIT_FUNC PyInit_json (void ) {
78
+ import_array ()
76
79
initObjToJSON (); // TODO(username): clean up, maybe via tp_free?
77
80
return PyModuleDef_Init (& moduledef );
78
81
}
You can’t perform that action at this time.
0 commit comments