This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author xdegaye
Recipients emptysquare, pitrou, serhiy.storchaka, vstinner, xdegaye
Date 2014-11-26.20:55:18
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1417035318.69.0.936446386249.issue22898@psf.upfronthosting.co.za>
In-reply-to
Content
> out can be b'Done.\r\n'. Use self.assertIn.

Ok, new patch attached.


>> If both patches were to be included, the test case in warn_4.patch would test the above patch and not the changes made in Python/_warnings.c.
> You can test err for warning message.

In the case where PyExc_RecursionErrorInst would not leak frames, the code path followed by the test case would not run any of the changes made in _warnings.c.


> The traceback should be cleared before decrementing the reference count. And only if Py_REFCNT(v) is 2.

I believe that attempting to fix the frames leak by clearing the traceback implies the following changes:
    * The previous patch to PyErr_PrintEx()
    * v->context and v->cause should also be tested against equality with PyExc_RecursionErrorInst.
    * In PyErr_PrintEx() the variable v2 may also be PyExc_RecursionErrorInst.
    * The sames change should also be done when freeing the exception value at least:
        in PyErr_WriteUnraisable() called when an exception occurs during finalization
        in PyErr_Restore()
        [1] when sys.last_value is cleared in PyImport_Cleanup()
And that would miss the case [1] where sys.last_value is set to None by some python user code.

Note [1]:
Unless it is acceptable to clear the PyExc_RecursionErrorInst traceback even when sys.last_value has been set (then Py_REFCNT(v) is 3 instead of 2).

Not sure if this is worth the trouble.
History
Date User Action Args
2014-11-26 20:55:18xdegayesetrecipients: + xdegaye, pitrou, vstinner, serhiy.storchaka, emptysquare
2014-11-26 20:55:18xdegayesetmessageid: <1417035318.69.0.936446386249.issue22898@psf.upfronthosting.co.za>
2014-11-26 20:55:18xdegayelinkissue22898 messages
2014-11-26 20:55:18xdegayecreate