[Python-Dev] Quick-and-dirty weak references
Vladimir Marangozov
Vladimir.Marangozov@inrialpes.fr
Wed, 18 Aug 1999 14:12:14 +0100 (NFT)
[about mxProxy, WeakProxy]
M.-A. Lemburg wrote:
>
> Could you tell me where the core dump originates ? Also, it would
> help to compile the package with the -DMAL_DEBUG switch turned
> on (edit Setup) and then run the same things using 'python -d'.
> The package will then print a pretty complete list of things it
> is doing to mxProxy.log, which would help track down errors like
> these.
>
> BTW, I get:
> >>> print p
>
> Traceback (innermost last):
> File "<stdin>", line 1, in ?
> mxProxy.LostReferenceError: object already garbage collected
> >>>
>
> [Don't know why the print statement prints an empty line, though.]
>
The previous example now *seems* to work fine in a freshly launched
interpreter, so it's not a good example, but this shorter one
definitely doesn't:
>>> from Proxy import WeakProxy
>>> o = []
>>> p = q = WeakProxy(o)
>>> p = q = WeakProxy(o)
>>> del o
>>> print p or q
Illegal instruction (core dumped)
Or even shorter:
>>> from Proxy import WeakProxy
>>> o = []
>>> p = q = WeakProxy(o)
>>> p = WeakProxy(o)
>>> del o
>>> print p
Illegal instruction (core dumped)
It crashes in PyDict_DelItem() called from mxProxy_CollectWeakReference().
I can mail you a complete trace in private, if you still need it.
--
Vladimir MARANGOZOV | Vladimir.Marangozov@inrialpes.fr
http://sirac.inrialpes.fr/~marangoz | tel:(+33-4)76615277 fax:76615252