[XML-SIG] Expat and the Python Profiler

Martin v. Loewis martin@v.loewis.de
16 Aug 2002 21:24:56 +0200

Alexandre <Alexandre.Fayolle@logilab.fr> writes:

> The Frame created by pyexpat is unknown to the profiler when the
> callback function is executed. 
> This looks like a recent change in pyexpat  (to avoid dumping core when an 
> exception is raised in a callback maybe?), but not being able to profile
> code is really annoying. 

My question: What version? There was a relatively recent (read:
January 2001) change to pyexpat.c to add that frame, and a even more
recent change (read: August 2002) to fix the problem with tracing.

> So the first question is: is this a feature of expat, or a bug in the
> profiler? Do you have any suggestion?

It's a feature in expat to add this frame, so that a traceback in the
callback won't show feed() as the topmost function.

It's a bug in pyexpat.c (as shipped in PyXML 0.8) that this broke
tracing; it's a fix in 2.72 of Python CVS that corrects this bug.

If you need an urgent fix for your code base, feel free to backport
this fix to whereever you need it; I'm leaving for two weeks, so I
don't have the time to do this myself.