Abort trap - Fatal Python error: GC object already tracked

P

p.lavarre

Is this interesting Python output?

$ gc-object-already-tracked.py

**********************************************************************
File "/Users/admin/Desktop/lxio/gc-object-already-tracked.py", line
770, in __main__.REDACTED
Failed example:
nqzhexes(self.send())
Expected:
'... [redacted] ...'z
Got:
'... [redacted] ...'
Fatal Python error: GC object already tracked
Abort trap
$
$ /usr/bin/env python --version
Python 2.5.1
$ uname
Darwin
$

I can just avoid it, I don't need to solve it, but tell me I can help
by solving it, and I'll look more closely.

I can't just share all this source with you - I wrote a simulation for
pay under c*nfidentiality - but if I find I can throw away most of the
source and still produce the error, I could share that.
 
P

p.lavarre

Is this interesting Python output? ...
Fatal Python error: GC object already tracked
Abort trap

... tell me I can help by solving it, and
I'll look more closely.

Sorry, never mind, not interesting after all.

Newbie me did somehow forget the fact that ctypes.memmove doesn't
bounds-check, e.g. there is no error raised by overwriting memory not
owned, which then naturally degrades the stability of the GC etc.
import ctypes

bytes = (3 * ctypes.c_ubyte)()
bytes[0], bytes[1], bytes[2] (0, 0, 0)
CP = ctypes.POINTER
ctypes.cast(ctypes.addressof(bytes) + 3, CP(ctypes.c_ubyte)).contents.value 0

result = ctypes.memmove(ctypes.addressof(bytes), '\1\3\5\7', 4)
bytes[0], bytes[1], bytes[2] (1, 3, 5)
ctypes.cast(ctypes.addressof(bytes) + 3, CP(ctypes.c_ubyte)).contents.value 7
 

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,763
Messages
2,569,562
Members
45,038
Latest member
OrderProperKetocapsules

Latest Threads

Top