Skip to content

Drop support for Python 3.8 #585

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

Merged
merged 4 commits into from
Apr 16, 2025
Merged

Drop support for Python 3.8 #585

merged 4 commits into from
Apr 16, 2025

Conversation

Viicos
Copy link
Contributor

@Viicos Viicos commented Apr 16, 2025

Fixes #568.

@Viicos
Copy link
Contributor Author

Viicos commented Apr 16, 2025

Not sure if anything should be done here?

def _could_be_inserted_optional(t):
"""detects Union[..., None] pattern"""
# 3.8+ compatible checking before _UnionGenericAlias
if get_origin(t) is not Union:
return False

cc @Daraan

@Daraan
Copy link
Contributor

Daraan commented Apr 16, 2025

Not sure if anything should be done here?

def _could_be_inserted_optional(t):
"""detects Union[..., None] pattern"""
# 3.8+ compatible checking before _UnionGenericAlias
if get_origin(t) is not Union:
return False

cc @Daraan

3.9 introduced _UnionGenericAlias. The code can now be adjusted to use it directly like this:

 def _could_be_inserted_optional(t): 
     """detects Union[..., None] pattern""" 
-     # 3.8+ compatible checking before _UnionGenericAlias 
-     if get_origin(t) is not Union: 
+     if not isinstance(t, typing._UnionGenericAlias):
         return False 

Copy link
Member

@AlexWaygood AlexWaygood left a comment

Choose a reason for hiding this comment

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

Thank you, this overall looks great! I have a smattering of nits and a couple of substantive comments:

Copy link
Member

@AlexWaygood AlexWaygood left a comment

Choose a reason for hiding this comment

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

LGTM

@AlexWaygood AlexWaygood merged commit 7cfb2c0 into python:main Apr 16, 2025
20 checks passed
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.

Drop support for Python 3.8
4 participants