
Occasionally, if I reinitialize Python and rerun a script, I get the following error:
FATAL Python error: UNREF invalid object
from my code I do the following: /* alot of other crap and then */ PyRun_SimpleString("From Numeric import *\n");
eventually in multiarraymodule.c array_set_string_function() Py_INCREF(Py_None)
which eventually calls (according to my stack trace) where the error occurs PyArray_SetStringFunction() Py_XDECREF(PyArray_ReprFunction)
Is this a Numpy problem, Python problem, or my problem?
I can run the same python script several times, and then I get the error. Something isn't being cleaned up properly around Py_Initialize() Py_Finalize() pair.
I am using Python 2.1b1 and Numeric 18_1 with Boost

More info:
I can reproduce this error with the following loop:
for (int x = 0; x < 100; x++) { Py_Initialize(); import_array(); PyRun_SimpleString("from Numeric import *\n"); TRACE("%d\n",x); Py_Finalize(); }
Here is the output: 0 1 Fatal Python error: UNREF invalid object
participants (1)
-
Karl Bellve