Bug 1792067

Summary: python-curio fails to build with Python 3.9: async/await not allowed inside an async_thread context block
Product: [Fedora] Fedora Reporter: Miro Hrončok <mhroncok>
Component: python-curioAssignee: Carl George 🤠 <carl>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: carl, cstratak, mhroncok
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-03-18 04:13:29 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1785415    

Description Miro Hrončok 2020-01-16 23:22:36 UTC
python-curio fails to build with Python 3.9.0a2.

ERROR    curio.kernel:kernel.py:768 Task Crash: Task(id=598, name='test_async_thread_call.<locals>.main', state='TERMINATED')
Traceback (most recent call last):
  File "/builddir/build/BUILDROOT/python-curio-0.9-5.fc32.x86_64/usr/lib/python3.9/site-packages/curio/kernel.py", line 736, in _run_coro
    trap = current._send(current.next_value)
  File "/builddir/build/BUILDROOT/python-curio-0.9-5.fc32.x86_64/usr/lib/python3.9/site-packages/curio/task.py", line 167, in _task_runner
    return await coro
  File "/builddir/build/BUILD/curio-0.9/tests/test_thread.py", line 296, in main
    await coro1()
  File "/builddir/build/BUILD/curio-0.9/tests/test_thread.py", line 289, in coro1
    async with spawn_thread():
  File "/builddir/build/BUILDROOT/python-curio-0.9-5.fc32.x86_64/usr/lib/python3.9/site-packages/curio/thread.py", line 186, in __aenter__
    raise RuntimeError("async/await not allowed inside an async_thread context block")
RuntimeError: async/await not allowed inside an async_thread context block
ERROR    curio.debug:debug.py:56 Task(id=598, name='test_async_thread_call.<locals>.main', state='TERMINATED') crashed
Traceback (most recent call last):
  File "/builddir/build/BUILDROOT/python-curio-0.9-5.fc32.x86_64/usr/lib/python3.9/site-packages/curio/kernel.py", line 736, in _run_coro
    trap = current._send(current.next_value)
  File "/builddir/build/BUILDROOT/python-curio-0.9-5.fc32.x86_64/usr/lib/python3.9/site-packages/curio/task.py", line 167, in _task_runner
    return await coro
  File "/builddir/build/BUILD/curio-0.9/tests/test_thread.py", line 296, in main
    await coro1()
  File "/builddir/build/BUILD/curio-0.9/tests/test_thread.py", line 289, in coro1
    async with spawn_thread():
  File "/builddir/build/BUILDROOT/python-curio-0.9-5.fc32.x86_64/usr/lib/python3.9/site-packages/curio/thread.py", line 186, in __aenter__
    raise RuntimeError("async/await not allowed inside an async_thread context block")
RuntimeError: async/await not allowed inside an async_thread context block

I don't know yet where is this coming from.


For the build logs, see:
https://copr-be.cloud.fedoraproject.org/results/@python/python3.9/fedora-rawhide-x86_64/01148892-python-curio/

For all our attempts to build python-curio with Python 3.9, see:
https://copr.fedorainfracloud.org/coprs/g/python/python3.9/package/python-curio/

Testing and mass rebuild of packages is happening in copr. You can follow these instructions to test locally in mock if your package builds with Python 3.9:
https://copr.fedorainfracloud.org/coprs/g/python/python3.9/

Let us know here if you have any questions.

Python 3.9 will be included in Fedora 33. To make that update smoother, we're building Fedora packages with early pre-releases of Python 3.9.
A build failure prevents us from testing all dependent packages (transitive [Build]Requires), so if this package is required a lot, it's important for us to get it fixed soon.
We'd appreciate help from the people who know this package best, but if you don't want to work on this now, let us know so we can try to work around it on our side.

Comment 1 Ben Cotton 2020-02-11 17:34:04 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 32 development cycle.
Changing version to 32.

Comment 2 Miro Hrončok 2020-03-16 12:59:20 UTC
Carl, could you please have look and report this upstream if needed? Thanks.

Comment 3 Carl George 🤠 2020-03-18 04:13:29 UTC
Looks like upstream added tests that make outbound internet connections [0].  I sorted it out with a pytest custom marker, but it looks like upstream doesn't typically accept pull requests.  I've opened an issue to see if they're interested [1].  I've added it as a patch in the spec file, and it now builds on Rawhide [2] as well as locally with the @python/python3.9 COPR.

[0]: https://github.com/dabeaz/curio/commit/96ed9c5375ef6c24b373870f757994268cae36a8
[1]: https://github.com/dabeaz/curio/issues/320
[2]: https://bodhi.fedoraproject.org/updates/FEDORA-2020-c683439106

Comment 4 Miro Hrončok 2020-03-18 09:49:46 UTC
Thank You!