Skip to content

Drop support for Python 3.8#585

Merged
AlexWaygood merged 4 commits into
python:mainfrom
Viicos:drop-38
Apr 16, 2025
Merged

Drop support for Python 3.8#585
AlexWaygood merged 4 commits into
python:mainfrom
Viicos:drop-38

Conversation

@Viicos

@Viicos Viicos commented Apr 16, 2025

Copy link
Copy Markdown
Contributor

Fixes #568.

@Viicos

Viicos commented Apr 16, 2025

Copy link
Copy Markdown
Contributor Author

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

Daraan commented Apr 16, 2025

Copy link
Copy Markdown
Contributor

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 

@AlexWaygood AlexWaygood left a comment

Copy link
Copy Markdown
Member

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:

Comment thread src/test_typing_extensions.py Outdated
Comment thread src/typing_extensions.py Outdated
Comment thread src/typing_extensions.py Outdated
Comment thread src/typing_extensions.py
Comment thread src/typing_extensions.py Outdated
Comment thread src/typing_extensions.py Outdated
Comment thread src/typing_extensions.py Outdated
Comment thread src/typing_extensions.py Outdated
Comment thread src/typing_extensions.py Outdated
Comment thread src/typing_extensions.py Outdated
Comment thread src/typing_extensions.py Outdated
Comment thread src/typing_extensions.py Outdated
Comment thread src/typing_extensions.py Outdated
Comment thread src/typing_extensions.py Outdated
Comment thread src/typing_extensions.py Outdated

@AlexWaygood AlexWaygood left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

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