[ty] Fix bound TypeVar default cycle recovery#26124
Merged
Merged
Conversation
Typing conformance resultsNo changes detected ✅Current numbersThe percentage of diagnostics emitted that were expected errors held steady at 94.37%. The percentage of expected errors that received a diagnostic held steady at 89.00%. The number of fully passing files held steady at 94/134. |
Memory usage reportMemory usage unchanged ✅ |
|
| Lint rule | Added | Removed | Changed |
|---|---|---|---|
unresolved-attribute |
0 | 0 | 21 |
invalid-assignment |
0 | 0 | 2 |
invalid-argument-type |
0 | 0 | 1 |
| Total | 0 | 0 | 24 |
Flaky changes detected. This PR summary excludes flaky changes; see the HTML report for details.
Raw diff (24 changes)
boostedblob (https://github.com/hauntsaninja/boostedblob)
- boostedblob/listing.py:402:14 error[unresolved-attribute] Object of type `Element[Unknown]` has no attribute `iterchildren`
+ boostedblob/listing.py:402:14 error[unresolved-attribute] Object of type `Element[str]` has no attribute `iterchildren`
cloud-init (https://github.com/canonical/cloud-init)
- cloudinit/sources/helpers/azure.py:518:32 error[unresolved-attribute] Attribute `text` is not defined on `None` in union `Element[Unknown] | None`
+ cloudinit/sources/helpers/azure.py:518:32 error[unresolved-attribute] Attribute `text` is not defined on `None` in union `Element[str] | None`
dd-trace-py (https://github.com/DataDog/dd-trace-py)
- tests/contrib/pytest/test_pytest_atr.py:337:16 error[unresolved-attribute] Attribute `attrib` is not defined on `None` in union `Element[Unknown] | None`
+ tests/contrib/pytest/test_pytest_atr.py:337:16 error[unresolved-attribute] Attribute `attrib` is not defined on `None` in union `Element[str] | None`
- tests/contrib/pytest/test_pytest_atr.py:338:16 error[unresolved-attribute] Attribute `attrib` is not defined on `None` in union `Element[Unknown] | None`
+ tests/contrib/pytest/test_pytest_atr.py:338:16 error[unresolved-attribute] Attribute `attrib` is not defined on `None` in union `Element[str] | None`
- tests/contrib/pytest/test_pytest_atr.py:339:16 error[unresolved-attribute] Attribute `attrib` is not defined on `None` in union `Element[Unknown] | None`
+ tests/contrib/pytest/test_pytest_atr.py:339:16 error[unresolved-attribute] Attribute `attrib` is not defined on `None` in union `Element[str] | None`
- tests/contrib/pytest/test_pytest_atr.py:340:16 error[unresolved-attribute] Attribute `attrib` is not defined on `None` in union `Element[Unknown] | None`
+ tests/contrib/pytest/test_pytest_atr.py:340:16 error[unresolved-attribute] Attribute `attrib` is not defined on `None` in union `Element[str] | None`
- tests/contrib/pytest/test_pytest_attempt_to_fix.py:259:16 error[unresolved-attribute] Attribute `attrib` is not defined on `None` in union `Element[Unknown] | None`
+ tests/contrib/pytest/test_pytest_attempt_to_fix.py:259:16 error[unresolved-attribute] Attribute `attrib` is not defined on `None` in union `Element[str] | None`
- tests/contrib/pytest/test_pytest_attempt_to_fix.py:260:16 error[unresolved-attribute] Attribute `attrib` is not defined on `None` in union `Element[Unknown] | None`
+ tests/contrib/pytest/test_pytest_attempt_to_fix.py:260:16 error[unresolved-attribute] Attribute `attrib` is not defined on `None` in union `Element[str] | None`
- tests/contrib/pytest/test_pytest_attempt_to_fix.py:261:16 error[unresolved-attribute] Attribute `attrib` is not defined on `None` in union `Element[Unknown] | None`
+ tests/contrib/pytest/test_pytest_attempt_to_fix.py:261:16 error[unresolved-attribute] Attribute `attrib` is not defined on `None` in union `Element[str] | None`
- tests/contrib/pytest/test_pytest_attempt_to_fix.py:262:16 error[unresolved-attribute] Attribute `attrib` is not defined on `None` in union `Element[Unknown] | None`
+ tests/contrib/pytest/test_pytest_attempt_to_fix.py:262:16 error[unresolved-attribute] Attribute `attrib` is not defined on `None` in union `Element[str] | None`
- tests/contrib/pytest/test_pytest_attempt_to_fix.py:271:16 error[unresolved-attribute] Attribute `attrib` is not defined on `None` in union `Element[Unknown] | None`
+ tests/contrib/pytest/test_pytest_attempt_to_fix.py:271:16 error[unresolved-attribute] Attribute `attrib` is not defined on `None` in union `Element[str] | None`
- tests/contrib/pytest/test_pytest_attempt_to_fix.py:272:16 error[unresolved-attribute] Attribute `attrib` is not defined on `None` in union `Element[Unknown] | None`
+ tests/contrib/pytest/test_pytest_attempt_to_fix.py:272:16 error[unresolved-attribute] Attribute `attrib` is not defined on `None` in union `Element[str] | None`
- tests/contrib/pytest/test_pytest_attempt_to_fix.py:273:16 error[unresolved-attribute] Attribute `attrib` is not defined on `None` in union `Element[Unknown] | None`
+ tests/contrib/pytest/test_pytest_attempt_to_fix.py:273:16 error[unresolved-attribute] Attribute `attrib` is not defined on `None` in union `Element[str] | None`
- tests/contrib/pytest/test_pytest_attempt_to_fix.py:274:16 error[unresolved-attribute] Attribute `attrib` is not defined on `None` in union `Element[Unknown] | None`
+ tests/contrib/pytest/test_pytest_attempt_to_fix.py:274:16 error[unresolved-attribute] Attribute `attrib` is not defined on `None` in union `Element[str] | None`
- tests/contrib/pytest/test_pytest_efd.py:517:16 error[unresolved-attribute] Attribute `attrib` is not defined on `None` in union `Element[Unknown] | None`
+ tests/contrib/pytest/test_pytest_efd.py:517:16 error[unresolved-attribute] Attribute `attrib` is not defined on `None` in union `Element[str] | None`
- tests/contrib/pytest/test_pytest_efd.py:518:16 error[unresolved-attribute] Attribute `attrib` is not defined on `None` in union `Element[Unknown] | None`
+ tests/contrib/pytest/test_pytest_efd.py:518:16 error[unresolved-attribute] Attribute `attrib` is not defined on `None` in union `Element[str] | None`
meson (https://github.com/mesonbuild/meson)
- mesonbuild/mtest.py:1132:17 error[invalid-assignment] Object of type `ElementTree[Element[Unknown]]` is not assignable to attribute `junit` of type `ElementTree[Element[Unknown] | None] | None`
+ mesonbuild/mtest.py:1132:17 error[invalid-assignment] Object of type `ElementTree[Element[str]]` is not assignable to attribute `junit` of type `ElementTree[Element[str] | None] | None`
- run_project_tests.py:1290:38 error[invalid-argument-type] Argument to function `SubElement` is incorrect: Expected `Element[Any]`, found `Unknown | Element[Unknown] | None`
+ run_project_tests.py:1290:38 error[invalid-argument-type] Argument to function `SubElement` is incorrect: Expected `Element[Any]`, found `Unknown | Element[str] | None`
pandas (https://github.com/pandas-dev/pandas)
- pandas/io/xml.py:483:21 error[unresolved-attribute] Attribute `findall` is not defined on `None` in union `Element[Unknown] | Unknown | None`
+ pandas/io/xml.py:483:21 error[unresolved-attribute] Attribute `findall` is not defined on `None` in union `Element[str] | Unknown | None`
- pandas/io/xml.py:516:26 error[unresolved-attribute] Attribute `find` is not defined on `None` in union `Element[Unknown] | Unknown | None`
+ pandas/io/xml.py:516:26 error[unresolved-attribute] Attribute `find` is not defined on `None` in union `Element[str] | Unknown | None`
- pandas/io/xml.py:600:17 error[unresolved-attribute] Attribute `xpath` is not defined on `Element[Unknown]`, `None` in union `Element[Unknown] | Unknown | None`
+ pandas/io/xml.py:600:17 error[unresolved-attribute] Attribute `xpath` is not defined on `Element[str]`, `None` in union `Element[str] | Unknown | None`
- pandas/io/xml.py:626:28 error[unresolved-attribute] Attribute `xpath` is not defined on `Element[Unknown]`, `None` in union `Element[Unknown] | Unknown | None`
+ pandas/io/xml.py:626:28 error[unresolved-attribute] Attribute `xpath` is not defined on `Element[str]`, `None` in union `Element[str] | Unknown | None`
pytest (https://github.com/pytest-dev/pytest)
- src/_pytest/junitxml.py:256:9 error[invalid-assignment] Object of type `() -> Element[Unknown]` is not assignable to attribute `to_xml` of type `def to_xml(self) -> Element[Unknown]`
+ src/_pytest/junitxml.py:256:9 error[invalid-assignment] Object of type `() -> Element[str]` is not assignable to attribute `to_xml` of type `def to_xml(self) -> Element[str]`
spack (https://github.com/spack/spack)
- lib/spack/spack/test/conftest.py:1917:16 error[unresolved-attribute] Attribute `get` is not defined on `None` in union `Element[Unknown] | None`
+ lib/spack/spack/test/conftest.py:1917:16 error[unresolved-attribute] Attribute `get` is not defined on `None` in union `Element[str] | None`
charliermarsh
approved these changes
Jun 18, 2026
MichaReiser
commented
Jun 18, 2026
MichaReiser
commented
Jun 18, 2026
| return false; | ||
| } | ||
|
|
||
| if let Some(specialization) = type_alias.specialization(state.db) { |
Member
Author
There was a problem hiding this comment.
This is needed to prevent a stack overflow and looks very similar to what was added in #23652. I'm obviously way out of my depth here, but it doesn't look unreasonable :)
Member
Author
|
Member
Author
|
@charliermarsh would you mind taking another look. I made a few more changes. |
charliermarsh
approved these changes
Jun 18, 2026
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.
Summary
Preserve bound TypeVar defaults during Salsa fixed-point cycle recovery instead of replacing provisional values with None. This prevents query-order-dependent diagnostics in cyclic generic definitions and fixes astral-sh/ty#3804.
Test Plan
Testing: added regression coverage and ran focused semantic tests, Clippy, and repository hooks.