Solve issues with deferral; related minor corrections#1
Closed
LordGiacomoS wants to merge 73 commits into
Closed
Conversation
Add a few additional annotations
Update subsample and zoom method signatures
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* Add Python 3.15 TypedDict attributes * Use AnnotationForm for TypedDict extra items
…manually" invoking Black (python#15909)
* `typing_extensions`: re-export `builtins.sentinel` on Python 3.15+ This would make ty's implementation of `builtins.sentinel` a little easier * Update typing_extensions.pyi * Update typing_extensions version to 4.16.0rc1 * Update typing_extensions.pyi * allow * a surprise, to be sure, but a welcome one * Update stdlib/typing_extensions.pyi * harmonize builtins and typing_extensions, fix various `__(r)or__` methods * Apply suggestions from code review
See python#15947 for details. Closes: python#15942
* Update typing_extensions.TypeVarTuple with new backported features * Update typing_extensions to 4.16.0rc2 --------- Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
…inct (python#15949) it would be too easy for an eager contributor to revert python@4531374 in the name of simplifying the stub
* Add typed fields, queries, and update to some of the new APIs * Type the field classes * Type query results * Mark kwargs TypedDicts type_check_only and fix TypedDict import * Instead of separating get/set, just override for BigBitField.
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
* Update most test/lint dependencies * Update metadata.py --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
…fect While existing examples of changing a class to an alias, such as `shutil.ExecError` -> `RuntimeError` and `socket.timeout` -> `TimeoutError`, use `<old> = <new>` syntax, this change causes issues for typing.Union in particular. The syntax creates an intermediary TypeAlias object, which is an issue in this particular case because mypy asserts that `types.UnionType` is an actual type, and not an alias pointing to another type. Instead, the code employs a technique regularly used by typing_extensions, and imports the new type under the pseudonym of the old type.
Previous commit message was also amended to slightly better explain how the crash fix actually works
- removed some inaccurate notes left over from when Viicos copied types.UnionType - added optional `@classmethod` decorator to `typing.Union.__class_getitem__`, to be in line with `typing._Generic.__class_getitem__` - make args of `typing.Union.__class_getitem__` positional, as per stubtest instruction
for purposes of passing certain stubtests that would otherwise fail due to outdated stubs
Author
|
Latest commit (#2eccc22 ) fixes issue found when running test cases on python 3.14 & 3.15, across all operating systems Issue in questionSource: https://github.com/LordGiacomoS/typeshed/actions/runs/29354539513/job/87161643214#step:4 |
LordGiacomoS
marked this pull request as draft
July 21, 2026 14:34
Author
|
The changes to |
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.
Fixes crash in mypy (python/mypy#21588) that caused deferral of this branch's PR (python/typeshed#13740) on the main typeshed, because while the crash could be solved in mypy, it seems more prudent to use this typeshed-based solution. Solutions that would modify mypy's code would introduce a redundant version check and still have the crash if an up-to-date version of typeshed isn't used. The exact changes that fix the crash are specifically the changes to
stdlib/types.pyiin 76cf69a).Other minor corrections:
get_originoverload changes (changes tostdlib/typing.pyi&stdlib/typing_extensions.pyiin 40d9f63) were done to solve conflicting overloads issue occuring during./tests/mypy_test.py stdlibwhen Union changes are in effect.builtins.type.__or__&builtins.type.__ror__(changes tostdlib/builtins.pyiin 40d9f63) were made to fix an issue with how mypy displaysreveal_typecalls on pep 604 unions (e.g.reveal_type(str | int)->types.UnionType | def () -> int).stdlib/types.pyiin 40d9f63; all changes in 96f1bf1) are minor amendments to fix incredibly minor details and make the linter happy.Remaining Concerns:
typing.Union.__name__&typing.Union.__qualname__: Given that it is valid when running mypy over code accessing these specific class properties, I don't believe this check is actually necessary, as they seemingly already exist implicitly. I'm not confident enough in this belief to touch things though.typing.Union: It doesn't seem like classes themselves are able to be allowlist entries, so maybe this should be something liketyping.Union.*?Stubtests: https://github.com/LordGiacomoS/typeshed/actions/runs/29355015820 (runs a different branch to allow me to use modified version of mypy to fix more minor errors that aren't in scope of crash specifically)
Tests: https://github.com/LordGiacomoS/typeshed/actions/runs/28957923025
Stubtest errors excerpt
Sourced from: https://github.com/LordGiacomoS/typeshed/actions/runs/28900665825/job/85736371504