bpo-26552: Fixed case where failing asyncio.ensure_future did not close the coroutine#30288
bpo-26552: Fixed case where failing asyncio.ensure_future did not close the coroutine#30288gvanrossum merged 2 commits into
asyncio.ensure_future did not close the coroutine#30288Conversation
|
In |
Sorry, something went wrong.
0d0fd3f to
ea3a9b4
Compare
January 24, 2022 07:26
|
(Rebased to main) |
Sorry, something went wrong.
|
*with hope* Does it fix |
Sorry, something went wrong.
I fixed that issue separately. |
Sorry, something went wrong.
gvanrossum
left a comment
There was a problem hiding this comment.
Hi Kumar, I had procrastinated on reviewing this because there's some complicated stuff going on. I finally found the time and noticed that the bpo issue was written somewhat misleadingly, so I've added a clarification there.
I now finally figured out what the real issue is and how to deal with it, and your code is correct:
- If the argument is a
Future, nothing more needs to be done - If it is a coroutine (i.e.
async def), we need to close it ifcreate_task()raisesRuntimeError(which it only does for one reason, i.e. if the event loop is closed) - If it is an awaitable (i.e. something with an
__await__()method), it may not have aclose()method; the wrapper created by_wrap_awaitable()doesn't need to be closed
So I'm going to land this now. Thanks for your patience!
Sorry, something went wrong.
|
@gvanrossum: Please replace |
Sorry, something went wrong.
⚠️⚠️⚠️ Buildbot failure ⚠️⚠️⚠️Hi! The buildbot PPC64LE CentOS9 3.x has failed when building commit 24cc641. What do you need to do:
You can take a look at the buildbot page here: https://buildbot.python.org/all/#builders/852/builds/10 Summary of the results of the build (if available): Click to see traceback logsremote: Enumerating objects: 13, done.
remote: Counting objects: 9% (1/11)
remote: Counting objects: 18% (2/11)
remote: Counting objects: 27% (3/11)
remote: Counting objects: 36% (4/11)
remote: Counting objects: 45% (5/11)
remote: Counting objects: 54% (6/11)
remote: Counting objects: 63% (7/11)
remote: Counting objects: 72% (8/11)
remote: Counting objects: 81% (9/11)
remote: Counting objects: 90% (10/11)
remote: Counting objects: 100% (11/11)
remote: Counting objects: 100% (11/11), done.
remote: Total 13 (delta 11), reused 11 (delta 11), pack-reused 2
From https://github.com/python/cpython
* branch main -> FETCH_HEAD
Note: switching to '24cc6411adbfe5555ecd8901f1ea50caa414c908'.
You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by switching back to a branch.
If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -c with the switch command. Example:
git switch -c <new-branch-name>
Or undo this operation with:
git switch -
Turn off this advice by setting config variable advice.detachedHead to false
HEAD is now at 24cc6411ad [bpo-26552](https://bugs.python.org/issue26552): Fixed case where failing `asyncio.ensure_future` did not close the coroutine (#30288)
Switched to and reset branch 'main'
Cannot create temporary file in /tmp/: No space left on device
../Python/thread.c:257:1: fatal error: error writing to /tmp/ccTo9nrX.s: No space left on device
257 | }
| ^
compilation terminated.
make: *** [Makefile:2392: Python/thread.o] Error 1
make: *** Waiting for unfinished jobs....
make: *** [Makefile:2392: Python/pystrtod.o] Aborted (core dumped)
../Python/pystrcmp.c:30:1: fatal error: error writing to /tmp/ccodR3vP.s: No space left on device
30 | }
| ^
compilation terminated.
make: *** [Makefile:2392: Python/pystrcmp.o] Error 1
../Parser/parser.c:35925:1: fatal error: error writing to /tmp/cc3DnvC8.s: No space left on device
35925 | }
| ^
compilation terminated.
make: *** [Makefile:2392: Parser/parser.o] Error 1
../Python/symtable.c:2188:1: fatal error: error writing to /tmp/cc0vWBNO.s: No space left on device
2188 | }
| ^
compilation terminated.
make: *** [Makefile:2392: Python/symtable.o] Error 1
../Python/traceback.c:1334:1: fatal error: error writing to /tmp/cc6eT91n.s: No space left on device
1334 | }
| ^
compilation terminated.
make: *** [Makefile:2392: Python/traceback.o] Error 1
../Python/sysmodule.c:3383:1: fatal error: error writing to /tmp/ccjLnafA.s: No space left on device
3383 | }
| ^
compilation terminated.
make: *** [Makefile:1373: Python/sysmodule.o] Error 1
../Objects/unicodeobject.c:16167:1: fatal error: error writing to /tmp/ccmwQWIw.s: No space left on device
16167 | }
| ^
compilation terminated.
make: *** [Makefile:2392: Objects/unicodeobject.o] Error 1
find: ‘build’: No such file or directory
find: ‘build’: No such file or directory
find: ‘build’: No such file or directory
find: ‘build’: No such file or directory
make: [Makefile:2472: clean-retain-profile] Error 1 (ignored) |
Sorry, something went wrong.
|
@gvanrossum I think this should be backported to 3.10 and 3.9. |
Sorry, something went wrong.
|
Yeah, makes sense. Adding the labels now. |
Sorry, something went wrong.
|
Thanks @kumaraditya303 for the PR, and @gvanrossum for merging it 🌮🎉.. I'm working now to backport this PR to: 3.9. |
Sorry, something went wrong.
|
Thanks @kumaraditya303 for the PR, and @gvanrossum for merging it 🌮🎉.. I'm working now to backport this PR to: 3.10. |
Sorry, something went wrong.
|
Sorry, @kumaraditya303 and @gvanrossum, I could not cleanly backport this to |
Sorry, something went wrong.
|
Sorry @kumaraditya303 and @gvanrossum, I had trouble checking out the |
Sorry, something went wrong.
…lose the coroutine (python#30288)
|
I am leaving 3.9 as it is too diverged from main. |
Sorry, something went wrong.
⚠️⚠️⚠️ Buildbot failure ⚠️⚠️⚠️Hi! The buildbot PPC64LE CentOS9 3.10 has failed when building commit a5451c9. What do you need to do:
You can take a look at the buildbot page here: https://buildbot.python.org/all/#builders/843/builds/5 Summary of the results of the build (if available): Click to see traceback logsremote: Enumerating objects: 13, done.
remote: Counting objects: 8% (1/12)
remote: Counting objects: 16% (2/12)
remote: Counting objects: 25% (3/12)
remote: Counting objects: 33% (4/12)
remote: Counting objects: 41% (5/12)
remote: Counting objects: 50% (6/12)
remote: Counting objects: 58% (7/12)
remote: Counting objects: 66% (8/12)
remote: Counting objects: 75% (9/12)
remote: Counting objects: 83% (10/12)
remote: Counting objects: 91% (11/12)
remote: Counting objects: 100% (12/12)
remote: Counting objects: 100% (12/12), done.
remote: Compressing objects: 9% (1/11)
remote: Compressing objects: 18% (2/11)
remote: Compressing objects: 27% (3/11)
remote: Compressing objects: 36% (4/11)
remote: Compressing objects: 45% (5/11)
remote: Compressing objects: 54% (6/11)
remote: Compressing objects: 63% (7/11)
remote: Compressing objects: 72% (8/11)
remote: Compressing objects: 81% (9/11)
remote: Compressing objects: 90% (10/11)
remote: Compressing objects: 100% (11/11)
remote: Compressing objects: 100% (11/11), done.
remote: Total 13 (delta 1), reused 11 (delta 1), pack-reused 1
From https://github.com/python/cpython
* branch 3.10 -> FETCH_HEAD
Note: switching to 'a5451c96a14ac0c3ee7cef7b5c52ab1d783ec613'.
You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by switching back to a branch.
If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -c with the switch command. Example:
git switch -c <new-branch-name>
Or undo this operation with:
git switch -
Turn off this advice by setting config variable advice.detachedHead to false
HEAD is now at a5451c96a1 [bpo-26552](https://bugs.python.org/issue26552): Fixed case where failing `asyncio.ensure_future` did not close the coroutine (#30288) (#31003)
Switched to and reset branch '3.10'
../Modules/_io/textio.c:3338:1: fatal error: error writing to /tmp/cc6yGOcE.s: No space left on device
3338 | };
| ^
compilation terminated.
make: *** [Makefile:2085: Modules/textio.o] Error 1
make: *** Waiting for unfinished jobs....
../Programs/_testembed.c:1899:1: fatal error: error writing to /tmp/cclxhfYW.s: No space left on device
1899 | }
| ^
compilation terminated.
make: *** [Makefile:816: Programs/_testembed.o] Error 1
/tmp/ccqYhb34.s: Assembler messages:
/tmp/ccqYhb34.s: Fatal error: can't close Objects/unicodeobject.o: No space left on device
make: *** [Makefile:1855: Objects/unicodeobject.o] Error 1
../Modules/posixmodule.c:15828:1: fatal error: error writing to /tmp/ccmkQztW.s: No space left on device
15828 | }
| ^
compilation terminated.
make: *** [Makefile:2046: Modules/posixmodule.o] Error 1
find: ‘build’: No such file or directory
find: ‘build’: No such file or directory
find: ‘build’: No such file or directory
find: ‘build’: No such file or directory
make: [Makefile:1928: clean-retain-profile] Error 1 (ignored) |
Sorry, something went wrong.
https://bugs.python.org/issue26552