Bugs item #1756389, was opened at 2007-07-18 14:02
Message generated for change (Comment added) made by jonklein
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1756389&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: Python Interpreter Core
Group: Python 2.5
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Jon Klein (jonklein)
Assigned to: Nobody/Anonymous (nobody)
Summary: reference count discrepancy, PyErr_Print vs. PyErr_Clear

Initial Comment:

Possible reference count leak in PyErr_Print?

When a call to PyObject_Call( someObject ) raises an exception, subsequently 
calling PyErr_Print and PyErr_Clear will result in different behaviors with 
respect to the reference count of "someObject".  The reference count of 
"someObject" will be 1 higher with PyErr_Print() than with PyErr_Clear().

Calling PyErr_Print followed by PyErr_Clear will still result in an extra 
reference count.

This may be the expected behavior, but it is not documented, and I cannot 
figure out how to "reclaim" the reference lost when using PyErr_Print.

Attached is a short C program which uses an embedded interpreter to illustrate 
the problem.  Below is the test of the simple Python module I use with the C 
program to demonstrate the problem.

- - - - 


class ExceptionTest:
        def RaiseException( self ):
                raise Exception()



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

>Comment By: Jon Klein (jonklein)
Date: 2007-07-18 14:20

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

File Added: ExceptionTest.cc

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

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1756389&group_id=5470
_______________________________________________
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to