[Python-bugs-list] [ python-Bugs-529750 ] Circular reference makes Py_Init crash
noreply@sourceforge.net
noreply@sourceforge.net
Fri, 13 Sep 2002 17:51:15 -0700
Bugs item #529750, was opened at 2002-03-13 23:52
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=529750&group_id=5470
Category: Python Interpreter Core
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Adam M. Fass (afass)
Assigned to: Nobody/Anonymous (nobody)
Summary: Circular reference makes Py_Init crash
Initial Comment:
Call Py_Initialize(), create two objects that
reference each other, then call Py_Finalize() and
then Py_Intialize() again. This crashes Python with
the following error message:
Fatal Python error: UNREF invalid object
The documentation on Py_Finalize() mentions that
circular references will cause memory leaks, but it
does not mention this behavior.
Platform info:
* Windows XP
* Visual C++ 6.0
* Python 2.2
------------------------------
#include "Python.h"
int main(int argc, char* argv[])
{
char *code1 = "class TestClass:\n\ti = 3\nt1
= TestClass()\nt2 = TestClass()\nt1.t = t2\nt2.t =
t1";
Py_Initialize();
PyRun_SimpleString(code1);
Py_Finalize();
Py_Initialize();
Py_Finalize();
}
------------------------------
The string "code1" contains this python code:
class TestClass:
i = 3
t1 = TestClass()
t2 = TestClass()
t1.t = t2
t2.t = t1
----------------------------------------------------------------------
>Comment By: Neal Norwitz (nnorwitz)
Date: 2002-09-13 20:51
Message:
Logged In: YES
user_id=33168
I just tried the sample code on 2.3.0 and 2.2.1+ on Linux.
This didn't crash or misbehave at all. Did you compile
python or did you get a binary distribution? Could there be
an incompatibility? Can you otherwise use python w/o
problems? Could it be specific to your box or windows in
general? Can you build python -with-pydebug? Can you test
with the python versions in CVS 2.2.1+ or 2.3?
----------------------------------------------------------------------
Comment By: Adam M. Fass (afass)
Date: 2002-09-10 14:32
Message:
Logged In: YES
user_id=485533
I just tried my code with 2.2.1 and got the same exact result.
My platform is still the same: Windows XP and Visual C++
6.0.
----------------------------------------------------------------------
Comment By: Neal Norwitz (nnorwitz)
Date: 2002-09-06 18:54
Message:
Logged In: YES
user_id=33168
Adam, do you still have this problem, with 2.2.1+?
----------------------------------------------------------------------
Comment By: Neil Schemenauer (nascheme)
Date: 2002-03-22 13:44
Message:
Logged In: YES
user_id=35752
I can't reproduce this on Linux with the latest CVS code.
I tried with and without Py_DEBUG defined.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=529750&group_id=5470