Skip to content

Conversation

graingert
Copy link
Contributor

@graingert graingert commented Oct 20, 2024

Fixes #637

graingert and others added 8 commits October 20, 2024 21:34
In extreme cases, isinstance(..., ()) may still
return False instead of raising a TypeError
This uses private API now.

Proper fix pending discussion in python/cpython#131148
* Add deprecation in docstring
* Stop using private API, refs python/cpython#131148
* Use AbstractEventLoop instead, after @Vizonex's suggestion
@fantix fantix changed the title test on 3.14 Fix build for Python 3.14 Sep 14, 2025
@fantix fantix marked this pull request as ready for review September 14, 2025 22:12
@fantix fantix requested a review from 1st1 September 14, 2025 22:12
Copy link

@Vizonex Vizonex left a comment

Choose a reason for hiding this comment

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

@graingert @fantix
I like the fact that my approach from winloop is being utilized here but would it be smart if the install() function threw an error if 3.16+ is used?

@fantix
Copy link
Member

fantix commented Sep 15, 2025

I'm not sure, but I feel like it's fine that uvloop.install raises AttributeError on Python 3.16 after versions of deprecation, maybe with a proper error message. Let me add that!

Copy link

@Vizonex Vizonex left a comment

Choose a reason for hiding this comment

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

Looks good. I'll have to mirror some of this myself even though I don't agree with all of it but it works nevertheless. You'll have to let 1st1 review it since I'm not the deciding factor but wanted to provide input and feedback to the project since I run the windows version of it.

cdef aio_set_running_loop = getattr(asyncio, '_set_running_loop', None)
cdef aio_debug_wrapper = getattr(asyncio.coroutines, 'debug_wrapper', None)
cdef aio_AbstractChildWatcher = asyncio.AbstractChildWatcher
cdef aio_AbstractChildWatcher = getattr(asyncio, "AbstractChildWatcher", ())
Copy link
Member

Choose a reason for hiding this comment

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

Why () and not just None?

Copy link
Member

Choose a reason for hiding this comment

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

() is a type, but None is not. We have usages like isinstance(..., aio_AbstractChildWatcher) and () returns False instead of TypeError.

Copy link
Contributor

Choose a reason for hiding this comment

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

() is shorthand for tuple()

Much like {} is shorthand for dict()

from ._version import __version__ # NOQA


__all__ = ('new_event_loop', 'install', 'EventLoopPolicy')
Copy link
Member

Choose a reason for hiding this comment

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

is _typing.Tuple[str, ...] necessary here?

Copy link
Member

Choose a reason for hiding this comment

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

Yeah the later __all__ += (...) would break typing

Copy link
Member

@1st1 1st1 left a comment

Choose a reason for hiding this comment

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

Good stuff, i've only two nit comments

davidpoblador added a commit to davidpoblador/uvloop that referenced this pull request Oct 8, 2025
@fantix fantix merged commit 46456b6 into MagicStack:master Oct 10, 2025
28 of 30 checks passed
fantix added a commit that referenced this pull request Oct 10, 2025
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
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 on 3.14
7 participants