Fatal error: GC object already tracked

E

Egil M?ller

I'm developing a larger Python program, and one component (a text
parser for a networking protocol) happend to be terribly slow, while
quite a simple piece of code, so I decided to reimplement it in C.

However, my code seems to do something in err, since the program
semi-randomly locks somewhere outside my C-code (after returning to
python), and semi-randomly issues a "Fatal error: GC object already
tracked". As this is my first C-module ever, nearly straight from the
HOWTO, I don't have much clue as to what is really wrong with my
code...

The code is available for inspection at
http://grimoire.takeit.se/files/CReader.c, and the error happens at
line 1111 in that file...

TIA
/Egil
 
G

Greg Chapman

I'm developing a larger Python program, and one component (a text
parser for a networking protocol) happend to be terribly slow, while
quite a simple piece of code, so I decided to reimplement it in C.

However, my code seems to do something in err, since the program
semi-randomly locks somewhere outside my C-code (after returning to
python), and semi-randomly issues a "Fatal error: GC object already
tracked". As this is my first C-module ever, nearly straight from the
HOWTO, I don't have much clue as to what is really wrong with my
code...

The code is available for inspection at
http://grimoire.takeit.se/files/CReader.c, and the error happens at
line 1111 in that file...

Your CReader_Buffer_dealloc method should be calling PyObject_GC_UnTrack before
doing anything else, see:

http://docs.python.org/api/supporting-cycle-detection.html

I can't say for sure that that will fix your problem, but given the error
message you're getting, it seems like a good place to start.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,009
Latest member
GidgetGamb

Latest Threads

Top