[ python-Patches-1733973 ] _lsprof.c:ptrace_enter_call assumes PyErr_* is clean

"SourceForge.net" <[email protected]>
Newsgroups gmane.comp.python.patches
Message-ID <[email protected]>
Patches item #1733973, was opened at 2007-06-09 11:04
Message generated for change (Comment added) made by peaker
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1733973&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Modules
Group: Python 2.6
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Eyal Lotem (peaker)
Assigned to: Nobody/Anonymous (nobody)
Summary: _lsprof.c:ptrace_enter_call assumes PyErr_* is clean

Initial Comment:
_lsprof.c:ptrace_enter_call assumes PyErr_* has no errors.
It assumes this by feeling free to call functions that PyErr_Clear and overwrite PyErr.

This assumption is broken when throwing into a generator. In that case gen_send_ex(.., 1) calls the ptrace_enter_call with an exception already set.

This assumption causes two bugs:
A. The exception thrown into the generator is overwritten and lost. Later it was also cleared.
B. gen_send_ex(..) still returns error-indication, but since the exception was cleared, you get a SystemError (error indication returned but no exception was set).

To fix this, ptrace_enter_call now saves/restores the current PyErr.

The attached patch was applied on the newest trunk svn. I guess it should be applicable without problems on the 2.5 bugfix branch as well.

----------------------------------------------------------------------

>Comment By: Eyal Lotem (peaker)
Date: 2007-06-09 11:30

Message:
Logged In: YES 
user_id=231480
Originator: YES

File Added: cProfile.patch

----------------------------------------------------------------------

Comment By: Eyal Lotem (peaker)
Date: 2007-06-09 11:24

Message:
Logged In: YES 
user_id=231480
Originator: YES

It seems that bug #1733757 encountered the same bug. See comments on that
bug.


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1733973&group_id=5470
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.