PyTypeObject *ArrayType;
PyTypeObject *ArrayIterType;
+ PyObject *array_reconstructor;
+
PyObject *str_read;
PyObject *str_write;
PyObject *str___dict__;
PyObject *array_str;
int typecode = self->ob_descr->typecode;
int mformat_code;
- static PyObject *array_reconstructor = NULL;
long protocol;
array_state *state = get_array_state_by_class(cls);
assert(state != NULL);
- if (array_reconstructor == NULL) {
- array_reconstructor = _PyImport_GetModuleAttrString(
+ if (state->array_reconstructor == NULL) {
+ state->array_reconstructor = _PyImport_GetModuleAttrString(
"array", "_array_reconstructor");
- if (array_reconstructor == NULL)
+ if (state->array_reconstructor == NULL) {
return NULL;
+ }
}
if (!PyLong_Check(value)) {
Py_DECREF(dict);
return NULL;
}
+
+ assert(state->array_reconstructor != NULL);
result = Py_BuildValue(
- "O(OCiN)O", array_reconstructor, Py_TYPE(self), typecode,
+ "O(OCiN)O", state->array_reconstructor, Py_TYPE(self), typecode,
mformat_code, array_str, dict);
Py_DECREF(dict);
return result;
array_state *state = get_array_state(module);
Py_VISIT(state->ArrayType);
Py_VISIT(state->ArrayIterType);
+ Py_VISIT(state->array_reconstructor);
return 0;
}
array_state *state = get_array_state(module);
Py_CLEAR(state->ArrayType);
Py_CLEAR(state->ArrayIterType);
+ Py_CLEAR(state->array_reconstructor);
Py_CLEAR(state->str_read);
Py_CLEAR(state->str_write);
Py_CLEAR(state->str___dict__);
PyObject *typecodes;
const struct arraydescr *descr;
+ state->array_reconstructor = NULL;
/* Add interned strings */
ADD_INTERNED(state, read);
ADD_INTERNED(state, write);