[issue40696] "await" hangs in Python3.9.0b1.

Chris Jerdonek report at bugs.python.org
Thu May 21 05:28:45 EDT 2020


Chris Jerdonek <chris.jerdonek at gmail.com> added the comment:

I just posted a draft PR that implements the narrower fix:
https://github.com/python/cpython/pull/20287
I confirmed that the Django test passes with it. I also included two regression tests: one using only generators, and one more like the Django test that awaits a task.

My solution was to update the exception context in gen_send_ex() using _PyErr_SetObject() instead of _PyErr_ChainExceptions() -- because _PyErr_SetObject() does the cycle detection we've been discussing, and _PyErr_ChainExceptions() doesn't.

While _PyErr_SetObject()'s cycle detection isn't complete in that it can't detect cycles that begin further down the chain, it's good enough for this case.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue40696>
_______________________________________


More information about the Python-bugs-list mailing list