Message32527
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()
|
|
Date |
User |
Action |
Args |
2007-08-23 14:58:44 | admin | link | issue1756389 messages |
2007-08-23 14:58:44 | admin | create | |
|