Message231729
> 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. |
|
Date |
User |
Action |
Args |
2014-11-26 20:55:18 | xdegaye | set | recipients:
+ xdegaye, pitrou, vstinner, serhiy.storchaka, emptysquare |
2014-11-26 20:55:18 | xdegaye | set | messageid: <1417035318.69.0.936446386249.issue22898@psf.upfronthosting.co.za> |
2014-11-26 20:55:18 | xdegaye | link | issue22898 messages |
2014-11-26 20:55:18 | xdegaye | create | |
|