-
-
Notifications
You must be signed in to change notification settings - Fork 32.2k
bpo-38785: Prevent asyncio from crashing #17144
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
constructor of object derived from asyncio.Future
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
Note: I would prefer to rename "ENSURE_FUTURE_ALIVE" to "ENSURE_FUTURE_INITIALIZED", but that can be done in a separated PR and it's unrelated to the issue :-)
I tested manually this PR: it does fix https://bugs.python.org/issue38785
Without this PR, the example crash.
With this PR, I get a warning an no crash:
vstinner@apu$ ./python scratch_15.py
In tratata before
In tratata2 before
Exception in callback <TaskStepMethWrapper object at 0x7f3ccfb878c0>()
handle: <Handle <TaskStepMethWrapper object at 0x7f3ccfb878c0>()>
Traceback (most recent call last):
File "/home/vstinner/python/master/Lib/asyncio/events.py", line 81, in _run
self._context.run(self._callback, *self._args)
RuntimeError: Future object is not initialized.
In tratata after
Yes, RuntimeError was my intention. |
Sorry, I can't merge this PR. Reason: |
Thanks @asvetlov for the PR 🌮🎉.. I'm working now to backport this PR to: 3.7, 3.8. |
GH-17147 is a backport of this pull request to the 3.8 branch. |
GH-17148 is a backport of this pull request to the 3.7 branch. |
if parent `__init__` is not called from a constructor of object derived from `asyncio.Future` https://bugs.python.org/issue38785 (cherry picked from commit dad6be5) Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
if parent `__init__` is not called from a constructor of object derived from `asyncio.Future` https://bugs.python.org/issue38785 (cherry picked from commit dad6be5) Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
if parent `__init__` is not called from a constructor of object derived from `asyncio.Future` https://bugs.python.org/issue38785 (cherry picked from commit dad6be5) Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
if parent `__init__` is not called from a constructor of object derived from `asyncio.Future` https://bugs.python.org/issue38785
if parent `__init__` is not called from a constructor of object derived from `asyncio.Future` https://bugs.python.org/issue38785
if parent
__init__
is not called from a constructor of object derived fromasyncio.Future
https://bugs.python.org/issue38785
Automerge-Triggered-By: @asvetlov