[Cython] Fwd: [issue3443] crash on badly initialised AttributeError
Stefan Behnel
stefan_ml at behnel.de
Sun Jul 27 08:28:24 CEST 2008
Talking about differences betweeen Cython and Python...
I got a crash in lxml's test suite with Python 3.0beta2, so I reported that to
the Python bug tracker. Looks like ours would have been more appropriate.
http://bugs.python.org/issue3443
Stefan
-------- Original-Message --------
Subject: [issue3443] crash on badly initialised AttributeError
Date: Fri, 25 Jul 2008 21:03:50 +0000
From: Amaury Forgeot d'Arc <amauryfa at gmail.com>
I reproduced the problem on Windows.
The exception shown is the AttributeError('next') raised and caught in
lxml._elementpath.find().
The "args" atribute is cleared in the BaseException_clear, during a call
to gc.collect() (in some tearDown() method).
Unfortunately this exception is still shomehow stored in the thread
state structure...
After some researches, I think that the problem is in Cython. Cython
tries to simulate a python frame without using the interpreter loop.
But at least an invariant is not respected: when a frame exits without
an exception set, the tstate->exc_type (and friends) should be NULL.
For example, at the end of the PyInit_etree() function (called by an
"import lxml.etree"), the tstate->exc_value contains an
AttributeError('module' object has no attribute 'unicode').
Now, the consequence may be that all these exceptions are "implicitely
chained" together. And there may be a subtle refcounting bug that shows
up only if this invariant is not respected.
More information about the Cython-dev
mailing list