mirror of
https://github.com/capnproto/pycapnp.git
synced 2025-03-04 00:14:45 +01:00
Fix 'AttributeError: '_UnixSelectorEventLoop' object has no attribute 'call_soon'
See haata/pycapnp#1 for a discussion. The cause of this bug is still unknown to me. But it likely has been fixed in Python 3.10. For some crazy reason, you can just keep retrying the offending call, and the attribute will magically 'reappear'.
This commit is contained in:
parent
ae965128de
commit
b22763f3c6
1 changed files with 11 additions and 1 deletions
|
@ -1806,7 +1806,17 @@ cdef cppclass AsyncIoEventPort(EventPort):
|
|||
if runnable:
|
||||
assert this.runHandle is None
|
||||
us = <void*>this;
|
||||
this.runHandle = this.asyncioLoop.call_soon(lambda: kjloop_runnable_callback(us))
|
||||
while True:
|
||||
# TODO: This loop is a workaround for the following occasional nondeterministic bug
|
||||
# that appears on Python 3.8 and 3.9:
|
||||
# AttributeError: '_UnixSelectorEventLoop' object has no attribute 'call_soon'
|
||||
# The cause of this is unknown (either a bug in our code, Cython, or Python).
|
||||
# It appears to no longer exist in Python 3.10. This can be removed once 3.9 is EOL.
|
||||
try:
|
||||
this.runHandle = this.asyncioLoop.call_soon(lambda: kjloop_runnable_callback(us))
|
||||
break
|
||||
except AttributeError:
|
||||
pass
|
||||
else:
|
||||
assert this.runHandle is not None
|
||||
this.runHandle.cancel()
|
||||
|
|
Loading…
Add table
Reference in a new issue