Skip to content
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

Inline _Py_RestoreSignals() from CPython #604

Merged
merged 2 commits into from
Aug 15, 2024

Conversation

befeleme
Copy link
Contributor

private _Py_RestoreSignals() has been moved to CPython internals as of Python 3.13 See: python/cpython#106400 Its implementation has been the same in all supported by uvloop Pythons (3.8+), so the inlining was not conditionalized.

Closes #603

This allows to build uvloop with Python 3.13.0a6.

Unfortunately, one of the tests fails and I can't tell whether it's related to this or it's an incidental breakage coming from some other parts of CPython changes:

=================================== FAILURES ===================================
___________________ Test_AIO_Unix.test_create_unix_server_1 ____________________
Traceback (most recent call last):
  File "/usr/lib64/python3.13/unittest/case.py", line 58, in testPartExecutor
    yield
  File "/usr/lib64/python3.13/unittest/case.py", line 651, in run
    self._callTestMethod(testMethod)
    ~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^
  File "/usr/lib64/python3.13/unittest/case.py", line 606, in _callTestMethod
    if method() is not None:
       ~~~~~~^^
  File "/builddir/build/BUILD/uvloop-0.19.0/_empty/tests/test_unix.py", line 147, in test_create_unix_server_1
    self.loop.run_until_complete(start_server())
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.13/asyncio/base_events.py", line 721, in run_until_complete
    return future.result()
           ~~~~~~~~~~~~~^^
  File "/builddir/build/BUILD/uvloop-0.19.0/_empty/tests/test_unix.py", line 100, in start_server
    self.assertTrue(os.path.exists(sock_name))
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.13/unittest/case.py", line 744, in assertTrue
    raise self.failureException(msg)
AssertionError: False is not true

private _Py_RestoreSignals() has been moved to CPython internals as of Python 3.13
See: python/cpython#106400
Its implementation has been the same in all supported by uvloop Pythons
(3.8+), so the inlining was not conditionalized.
@tacaswell
Copy link

I can confirm that this works with the 3.13 branch of cpython + the cython default branch (if the cython pinning in setup.py is removed).

Copy link
Member

@fantix fantix left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@fantix fantix merged commit 8511ba1 into MagicStack:master Aug 15, 2024
11 checks passed
fantix added a commit that referenced this pull request Aug 15, 2024
Changes
=======

* Upgrade libuv to v1.48.0 (#600)
  (by @niklasr22 @fantix in 7777852 for #596 #615)

Fixes
=====

* Fix test_create_server_4 with Python 3.12.5 (#614)
  (by @shadchin in 62f9239)

* Use len(os.sched_getaffinity(0)) instead of os.cpu_count() (#591)
  (by @avkarenow in c8531c2 for #591)

* Inline _Py_RestoreSignals() from CPython (#604)
  (by @befeleme in 8511ba1 for #603)
@fantix fantix mentioned this pull request Aug 15, 2024
edgarrmondragon pushed a commit to edgarrmondragon/uvloop that referenced this pull request Aug 19, 2024
Changes
=======

* Upgrade libuv to v1.48.0 (MagicStack#600)
  (by @niklasr22 @fantix in 7777852 for MagicStack#596 MagicStack#615)

Fixes
=====

* Fix test_create_server_4 with Python 3.12.5 (MagicStack#614)
  (by @shadchin in 62f9239)

* Use len(os.sched_getaffinity(0)) instead of os.cpu_count() (MagicStack#591)
  (by @avkarenow in c8531c2 for MagicStack#591)

* Inline _Py_RestoreSignals() from CPython (MagicStack#604)
  (by @befeleme in 8511ba1 for MagicStack#603)
@befeleme befeleme deleted the restore-signals branch August 20, 2024 08:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

uvloop fails to build with Python 3.13.0a5: error: implicit declaration of function ‘_Py_RestoreSignals’
3 participants