471,330 Members | 1,663 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,330 software developers and data experts.

Abort trap - Fatal Python error: GC object already tracked

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.

Jul 10 '07 #1
1 4050
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
>>>
Jul 10 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Egil M?ller | last post: by
7 posts views Thread by Morris | last post: by
18 posts views Thread by Urs Vogel | last post: by
7 posts views Thread by Josh | last post: by
reply views Thread by rosydwin | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.