classification
Title: pyexpat.c calls trace function incorrectly for exceptions
Type: behavior Stage: test needed
Components: XML Versions: Python 3.2, Python 3.1, Python 2.7
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: loewis, nedbat
Priority: normal Keywords:

Created on 2009-06-28 22:43 by nedbat, last changed 2010-07-10 23:33 by BreamoreBoy.

Files
File name Uploaded Description Edit
domshow.py nedbat, 2009-06-28 22:43 Demonstration code.
Messages (1)
msg89798 - (view) Author: Ned Batchelder (nedbat) Date: 2009-06-28 22:43
Pyexpat.c calls the tracing function explicitly (not sure why).  When it
intercepts an exception, it calls the function with PyTrace_EXCEPTION,
but then leaves the scope without calling PyTrace_RETURN.  This is
incorrect.  There should always be a PyTrace_RETURN for every PyTrace_CALL.

I've attached domshow.py to demonstrate the problem.

Running it produces many lines of output, including:

                     line expatbuilder.py 222
                     line expatbuilder.py 223
                     call pyexpat.c 905
                        call expatbuilder.py 892
                           line expatbuilder.py 894
                           line expatbuilder.py 900
                           exception expatbuilder.py 900
                           return expatbuilder.py 900
                        exception pyexpat.c 905
                        exception expatbuilder.py 223
                        line expatbuilder.py 225
                        line expatbuilder.py 226

The exception at line 905 in pyexpat.c should be followed with a return
from line 905 in pyexpat.c, but is not.  After that exception, the
nesting is off by one because the Calls and Returns don't match.
History
Date User Action Args
2010-07-10 23:33:19BreamoreBoysetnosy: + loewis
stage: test needed

versions: + Python 3.1, Python 2.7, Python 3.2, - Python 2.6, Python 2.5
2009-06-28 22:43:21nedbatcreate