-
-
Notifications
You must be signed in to change notification settings - Fork 110
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
Copy the coroutine status in deprecated #438
Conversation
On earlier versions of Python, there were two different functions, There's not much we can do for |
The 3.13 test fails, because this hasn't been implemented in 3.13 yet. It should be fixed with 3.13.rc1. What's the best course of action? |
I'd add a decorator like the one we already have here (which we can probably delete at this point): typing_extensions/src/test_typing_extensions.py Lines 125 to 128 in 70cec91
Something like this: skip_if_py313_beta = skipIf(
sys.version_info[:4] == (3, 13, 0, 'beta'),
"Bugfixes will be released in 3.13.0rc1"
) |
if sys.version_info >= (3, 12): | ||
wrapper = inspect.markcoroutinefunction(wrapper) | ||
else: | ||
wrapper._is_coroutine = asyncio.coroutines._is_coroutine |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems like the _is_coroutine
thing also exists on the CPython main
branch. I think it would be nice for @deprecated
to work consistently across Python versions as much as possible, so maybe we could just add the _is_coroutine
marker unconditionally, even though it isn't really necessary on py312+:
if sys.version_info >= (3, 12): | |
wrapper = inspect.markcoroutinefunction(wrapper) | |
else: | |
wrapper._is_coroutine = asyncio.coroutines._is_coroutine | |
wrapper._is_coroutine = asyncio.coroutines._is_coroutine | |
if sys.version_info >= (3, 12): | |
wrapper = inspect.markcoroutinefunction(wrapper) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd be wary about this. Why access a private item when not necessary? Especially since it gets overwritten immediately after?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fair enough, we can leave this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, well, it would fix the asyncio.coroutines.iscoroutinefunction()
test that's currently failing on Python 3.13.0b4. But I suppose that test could easily just be skipped only if we're on Python >=3.13 and <3.13.0rc1
Co-authored-by: Alex Waygood <[email protected]>
CI is passing now. |
No description provided.