[issue21178] doctest cause warnings in tests using generators
Terry J. Reedy
report at bugs.python.org
Fri Apr 11 21:22:28 CEST 2014
Terry J. Reedy added the comment:
I not am not sure I see a bug here, a discrepancy between doc and behavior. Even if not, you may have a legitimate enhancement request.
3.4 now warns about ignored exceptions during shutdown in case there is a fixable bug in the code being shut down. This is intended to be a feature, not a problem. I don't know if the warnings can be suppressed.
3.4 also implemented PEP 442 so "objects with __del__() methods, as well as generators with finally clauses, can be finalized when they are part of a reference cycle." Your second patch puts a generator in a reference cycle. Generators have a .__del__ method. Perhaps its body is the equivalent of "self.throw(GeneratorExit)". If so, that could be wrapped with the equivalent of "try:...except BaseException: pass" to avoid leaking exceptions.
----------
nosy: +ncoghlan, terry.reedy
stage: -> needs patch
versions: +Python 3.5
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue21178>
_______________________________________
More information about the Python-bugs-list
mailing list