For what it's worth, this recent issue: https://bugs.python.org/issue42762 is somewhat related to the non-async aspect of 533. (generator func getting closed during __del__ and causing odd side-effects at seemingly random points in the execution flow) The example code provided in that issue is contrived, and involves catching unconditional exceptions and recursing, but following the code flow in that situation feels unreasonably hard, and deciding if it's a python bug or not is even harder. I'm not sure how easy an implementation of 533 would be that doesn't break a lot of existing code, but if one could be made, it might help make generator lifecycles more predictable. On Tue, Jan 5, 2021 at 1:08 PM Senthil Kumaran <senthil@uthcode.com> wrote:
Hi Paul,
Per PEP 525, I can call aclose coroutine method to cleanup the generator, but it requires the code iterating to be aware that that closing the generator is necessary.
How about treating this as a bug for the specific use case that you mentioned, rather than a complete addition of " PEP 533 -- Deterministic cleanup for iterators". I am not certain why PEP 533 was deffered.
I'd also suggest a documentation update if the details of aclose requirement is mentioned only in a PEP and not in the documentation.
Thank you, Senthil _______________________________________________ Python-Dev mailing list -- python-dev@python.org To unsubscribe send an email to python-dev-leave@python.org https://mail.python.org/mailman3/lists/python-dev.python.org/ Message archived at https://mail.python.org/archives/list/python-dev@python.org/message/EPKMYH7D... Code of Conduct: http://python.org/psf/codeofconduct/