Message32529
The extra reference is hold in the traceback, which itself is hold in sys.last_traceback
PyErr_Print calls PyErr_PrintEx with set_sys_last_vars=1, indicating that sys.last_type/last_value/last_traceback should be set.
<http://docs.python.org/lib/module-sys.html#l2h-5144> says: "These three variables are not always defined; they are set when an exception is not handled and the interpreter prints an error message and a stack traceback. [...] (Since there is only one interactive thread, thread-safety is not a concern for these variables, unlike for exc_type etc.)"
So there is no reference leak. The next exception printed will clear the extra reference. If that's not acceptable, you can: a) avoid calling PyErr_Print, or use PyErr_Print(0). b) explicitely set those three attributes to None. c) at least set sys.last_traceback to None. |
|
Date |
User |
Action |
Args |
2007-08-23 14:58:45 | admin | link | issue1756389 messages |
2007-08-23 14:58:45 | admin | create | |
|