GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Compensate for asyncio changes in Python 3.13.3/3.14 by cjwatson · Pull Request #662 · MagicStack/uvloop

Conversation

@cjwatson

@cjwatson cjwatson commented Apr 16, 2025

Copy link
Copy Markdown
Contributor

In
python/cpython@38a9956 (backported to 3.13 as
python/cpython@7b0543e), Python moved the responsibility for setting the task name from asyncio.create_task to the Task constructor. While uvloop itself is unaffected, this causes test_set_task_name to fail when run with asyncio. Compensate for that in this particular test.

It's possible that uvloop's behaviour should be changed to match asyncio's depending on the Python version, but that seems like a more involved change. For now, this at least gets the tests passing again.

Most of this analysis and patch were from Martin Hostettler in https://bugs.debian.org/1101258#24; I just tweaked the patch slightly to ensure it still passes on older Python versions.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@cjwatson
Compensate for asyncio changes in Python 3.13.3/3.14
7c2f6d5
In
python/cpython@38a9956
(backported to 3.13 as
python/cpython@7b0543e),
Python moved the responsibility for setting the task name from
`asyncio.create_task` to the `Task` constructor.  While `uvloop` itself
is unaffected, this causes `test_set_task_name` to fail when run with
`asyncio`.  Compensate for that in this particular test.

It's possible that `uvloop`'s behaviour should be changed to match
`asyncio`'s depending on the Python version, but that seems like a more
involved change.  For now, this at least gets the tests passing again.

Most of this analysis and patch were from Martin Hostettler in
https://bugs.debian.org/1101258#24; I just tweaked the patch slightly to
ensure it still passes on older Python versions.
@cjwatson cjwatson mentioned this pull request Apr 16, 2025
uvloop fails on 3.14 #637
Closed
@cjwatson

cjwatson commented Apr 16, 2025

Copy link
Copy Markdown
Contributor Author

The test failures seem unrelated to my change.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@hroncok

hroncok commented Apr 16, 2025

Copy link
Copy Markdown
Contributor

I'm testing this together with #658 applied in Fedora.

The remaining failures I get are:

=================================== FAILURES ===================================
________________ TestUVExecutors.test_executors_process_pool_01 ________________
Traceback (most recent call last):
  File "/usr/lib64/python3.14/unittest/case.py", line 58, in testPartExecutor
    yield
  File "/usr/lib64/python3.14/unittest/case.py", line 660, in run
    self._callTestMethod(testMethod)
    ~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^
  File "/usr/lib64/python3.14/unittest/case.py", line 606, in _callTestMethod
    result = method()
  File "/builddir/build/BUILD/python-uvloop-0.21.0-build/uvloop-0.21.0/_empty/tests/test_executors.py", line 35, in test_executors_process_pool_01
    self.run_pool_test(concurrent.futures.ProcessPoolExecutor)
    ~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/builddir/build/BUILD/python-uvloop-0.21.0-build/uvloop-0.21.0/_empty/tests/test_executors.py", line 29, in run_pool_test
    self.loop.run_until_complete(run())
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^
  File "uvloop/loop.pyx", line 1518, in uvloop.loop.Loop.run_until_complete
  File "/builddir/build/BUILD/python-uvloop-0.21.0-build/uvloop-0.21.0/_empty/tests/test_executors.py", line 24, in run
    res = await asyncio.gather(*coros)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
concurrent.futures.process.BrokenProcessPool: A process in the process pool was terminated abruptly while the future was running or pending.
_______________ TestAIOExecutors.test_executors_process_pool_01 ________________
Traceback (most recent call last):
  File "/usr/lib64/python3.14/unittest/case.py", line 58, in testPartExecutor
    yield
  File "/usr/lib64/python3.14/unittest/case.py", line 660, in run
    self._callTestMethod(testMethod)
    ~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^
  File "/usr/lib64/python3.14/unittest/case.py", line 606, in _callTestMethod
    result = method()
  File "/builddir/build/BUILD/python-uvloop-0.21.0-build/uvloop-0.21.0/_empty/tests/test_executors.py", line 35, in test_executors_process_pool_01
    self.run_pool_test(concurrent.futures.ProcessPoolExecutor)
    ~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/builddir/build/BUILD/python-uvloop-0.21.0-build/uvloop-0.21.0/_empty/tests/test_executors.py", line 29, in run_pool_test
    self.loop.run_until_complete(run())
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^
  File "/usr/lib64/python3.14/asyncio/base_events.py", line 719, in run_until_complete
    return future.result()
           ~~~~~~~~~~~~~^^
  File "/builddir/build/BUILD/python-uvloop-0.21.0-build/uvloop-0.21.0/_empty/tests/test_executors.py", line 24, in run
    res = await asyncio.gather(*coros)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
concurrent.futures.process.BrokenProcessPool: A process in the process pool was terminated abruptly while the future was running or pending.
___________________ TestIssue39Regr.test_issue39_regression ____________________
Traceback (most recent call last):
  File "/builddir/build/BUILD/python-uvloop-0.21.0-build/uvloop-0.21.0/_empty/tests/test_regr1.py", line 114, in test_issue39_regression
    self.run_test()
    ~~~~~~~~~~~~~^^
  File "/builddir/build/BUILD/python-uvloop-0.21.0-build/uvloop-0.21.0/_empty/tests/test_regr1.py", line 93, in run_test
    addr = qout.get()
  File "/usr/lib64/python3.14/multiprocessing/queues.py", line 101, in get
    res = self._recv_bytes()
  File "/usr/lib64/python3.14/multiprocessing/connection.py", line 222, in recv_bytes
    buf = self._recv_bytes(maxlength)
  File "/usr/lib64/python3.14/multiprocessing/connection.py", line 447, in _recv_bytes
    buf = self._recv(4)
  File "/usr/lib64/python3.14/multiprocessing/connection.py", line 412, in _recv
    chunk = read(handle, to_read)
  File "/builddir/build/BUILD/python-uvloop-0.21.0-build/uvloop-0.21.0/_empty/tests/test_regr1.py", line 74, in on_alarm
    raise FailedTestError
tests.test_regr1.FailedTestError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib64/python3.14/unittest/case.py", line 58, in testPartExecutor
    yield
  File "/usr/lib64/python3.14/unittest/case.py", line 660, in run
    self._callTestMethod(testMethod)
    ~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^
  File "/usr/lib64/python3.14/unittest/case.py", line 606, in _callTestMethod
    result = method()
  File "/builddir/build/BUILD/python-uvloop-0.21.0-build/uvloop-0.21.0/_empty/tests/test_regr1.py", line 116, in test_issue39_regression
    self.fail('deadlocked in libuv')
    ~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.14/unittest/case.py", line 741, in fail
    raise self.failureException(msg)
AssertionError: deadlocked in libuv
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

1st1
1st1 approved these changes Apr 16, 2025
View reviewed changes
@1st1

1st1 commented Apr 16, 2025

Copy link
Copy Markdown
Member

@fantix our CI seem to consistently crash

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

fantix added 2 commits April 16, 2025 18:16
@fantix
Merge branch 'master' into asyncio-compensate-task-name
dc53aa2
@fantix
Don't use Cython beta
15ce4f6
This was for Cython 3.0 beta to test with Python 3.13,
but it's now breaking our tests with Cython 3.1, while
Cython 3.0 stable is out.
@fantix
fantix merged commit 96b7ed3 into MagicStack:master Apr 17, 2025
@fantix fantix mentioned this pull request Apr 18, 2025
create_task no longer calls set_name #664
Closed
FliegendeWurst added a commit to FliegendeWurst/nixpkgs that referenced this pull request Apr 26, 2025
@FliegendeWurst
python313Packages.uvloop: patch for broken tests
86f4724
MagicStack/uvloop#662
MagicStack/uvloop#663
@FliegendeWurst FliegendeWurst mentioned this pull request Apr 26, 2025
python313Packages.uvloop: patch for broken tests NixOS/nixpkgs#398352
Merged
2 of 13 tasks
@cjwatson
cjwatson deleted the asyncio-compensate-task-name branch May 4, 2025 11:39
fantix added a commit that referenced this pull request Oct 10, 2025
@fantix
uvloop 0.22.0
3ab519b
Changes
=======

* Fixes for Python 3.14 (#638)
  (by @graingert @hroncok @paulocheque @fantix in 46456b6 for #637)

Fixes
=====

* Use Cython `enum` for `__PREALLOCED_BUFS` (#634)
  (by @jakirkham in 7bb12a1 for #634)

* test: fix getaddrinfo test (#663)
  (by @fantix in 5680792 for #663)

* test: fix task name for Python 3.13.3/3.14 (#662)
  (by @cjwatson in 96b7ed3 for #662)
@fantix fantix mentioned this pull request Oct 10, 2025
uvloop 0.22.0 #692
Merged
fantix added a commit that referenced this pull request Oct 15, 2025
@fantix
uvloop 0.22.0
c660c77
Changes
=======

* Fixes for Python 3.14 (#638)
  (by @graingert @hroncok @paulocheque @fantix in 46456b6 for #637)

* Add free-threading support (#693)
  (by @kumaraditya303 in 286b370 for #642)

Fixes
=====

* Use Cython `enum` for `__PREALLOCED_BUFS` (#634)
  (by @jakirkham in 7bb12a1 for #634)

* test: fix getaddrinfo test (#663)
  (by @fantix in 5680792 for #663)

* test: fix task name for Python 3.13.3/3.14 (#662)
  (by @cjwatson in 96b7ed3 for #662)
fantix added a commit that referenced this pull request Oct 15, 2025
@fantix
uvloop 0.22.0
4106f7f
Changes
=======

* Fixes for Python 3.14 (#638)
  (by @graingert @hroncok @paulocheque @fantix in 46456b6 for #637)

* Add free-threading support (#693)
  (by @kumaraditya303 in 286b370 for #642)

Fixes
=====

* Use Cython `enum` for `__PREALLOCED_BUFS` (#634)
  (by @jakirkham in 7bb12a1 for #634)

* test: fix getaddrinfo test (#663)
  (by @fantix in 5680792 for #663)

* test: fix task name for Python 3.13.3/3.14 (#662)
  (by @cjwatson in 96b7ed3 for #662)
fantix added a commit that referenced this pull request Oct 16, 2025
@fantix
uvloop 0.22.0
5229115
Changes
=======

* Fixes for Python 3.14 (#638)
  (by @graingert @hroncok @paulocheque @fantix in 46456b6 for #637)

* Add free-threading support (#693)
  (by @kumaraditya303 in 286b370 for #642)

Fixes
=====

* Use Cython `enum` for `__PREALLOCED_BUFS` (#634)
  (by @jakirkham in 7bb12a1 for #634)

* test: fix getaddrinfo test (#663)
  (by @fantix in 5680792 d9fa054 for #663)

* test: fix task name for Python 3.13.3/3.14 (#662)
  (by @cjwatson in 96b7ed3 for #662)
fantix added a commit that referenced this pull request Oct 16, 2025
@fantix
uvloop 0.22.0
3cf6b44
Changes
=======

* Fixes for Python 3.14 (#638)
  (by @graingert @hroncok @paulocheque @fantix in 46456b6 for #637)

* Add free-threading support (#693)
  (by @kumaraditya303 in 286b370 for #642)

Fixes
=====

* Use Cython `enum` for `__PREALLOCED_BUFS` (#634)
  (by @jakirkham in 7bb12a1 for #634)

* test: fix getaddrinfo test (#663)
  (by @fantix in 5680792 d9fa054 for #663)

* test: fix task name for Python 3.13.3/3.14 (#662)
  (by @cjwatson in 96b7ed3 for #662)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@1st1 1st1 1st1 approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

4 participants

@cjwatson @hroncok @1st1 @fantix
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.