Fix typing bug for older python versions#3423
Closed
winterchristian wants to merge 1 commit into
Closed
Conversation
dlstadther
requested changes
May 8, 2026
Collaborator
dlstadther
left a comment
There was a problem hiding this comment.
Luigi removed official support for 3.9 with 6959c1f so this PR is N/A.
Author
|
Hi @dlstadther your right I missed that. Should I then close this PR, or should it still be merged out of consistency reasons? The whole file uses |
Collaborator
|
There are many places in the repo which haven't been moved away from I'll close this PR since its intention is n/a. Sorry for the confusion. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This fixes a typing bug introduced in #3416 that only affects older python versions (< python3.10).
Motivation and Context
In #3416 the type hint
strwas changed tostr | None. This works fine for all newer python versions >= 3.10. For the older version law uses thetyping-extensionslibrary to introduce typing support for older python versions <3.10.This library does not support the short equivalent
str | Noneinstead ofUnion[str, None]. In this case that one type isNoneit is also equivalent toOptional[str].So this PR just replaces
str | NonewithOptional[str].Have you tested this? If so, how?
As this is a trivial change, I tested it only locally with my setup using python3.9 and python3.13.