Nathaniel Smith <[email protected]> added the comment:
> Yury's theory: maybe BEFORE_ASYNC_WITH's error-handling path is forgetting to
> DECREF the object.
Nope, that doesn't seem to be it. This version prints "refcount: 2" twice,
*and* prints a proper "was never awaited" warning:
-----
import sys
async def open_file():
pass
async def main():
open_file_coro = open_file()
print("refcount:", sys.getrefcount(open_file_coro))
try:
async with open_file_coro:
pass
except:
pass
print("refcount:", sys.getrefcount(open_file_coro))
coro = main()
try:
coro.send(None)
except:
pass
----------
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue32703>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com