Skip to content

[ty] sys.implementation.version is not sys.version_info#25608

Merged
carljm merged 5 commits into
mainfrom
cjm/fix-sys-implementation
Jun 4, 2026
Merged

[ty] sys.implementation.version is not sys.version_info#25608
carljm merged 5 commits into
mainfrom
cjm/fix-sys-implementation

Conversation

@carljm

@carljm carljm commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

Summary

The way we special-cased sys.version_info accidentally also treated sys.implementation.version as always being the Python version, but this is only true for CPython. This was because both are instances of sys._version_info class in typeshed, and our special-casing operated at the level of that class.

Adjust things so that class is no longer treated as a singleton, and our special-casing operates at the instance layer rather than the class layer.

This also allows removing the now-unused ExpandedClassBaseEntry::Synthetic variant, which allows simplifying some diagnostic code.

Closes astral-sh/ty#3640

Testing

Added mdtest.

@astral-sh-bot astral-sh-bot Bot added the ty Multi-file analysis & type inference label Jun 3, 2026
@astral-sh-bot

astral-sh-bot Bot commented Jun 3, 2026

Copy link
Copy Markdown

Typing conformance results

No changes detected ✅

Current numbers
The percentage of diagnostics emitted that were expected errors held steady at 92.13%. The percentage of expected errors that received a diagnostic held steady at 87.18%. The number of fully passing files held steady at 92/134.

@astral-sh-bot

astral-sh-bot Bot commented Jun 3, 2026

Copy link
Copy Markdown

Memory usage report

Memory usage unchanged ✅

@astral-sh-bot

astral-sh-bot Bot commented Jun 3, 2026

Copy link
Copy Markdown

ecosystem-analyzer results

No diagnostic changes detected ✅

Full report with detailed diff (timing results)

@codspeed-hq

codspeed-hq Bot commented Jun 3, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 65 untouched benchmarks
⏩ 60 skipped benchmarks1


Comparing cjm/fix-sys-implementation (b534445) with main (a8a0614)

Open in CodSpeed

Footnotes

  1. 60 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@carljm carljm marked this pull request as ready for review June 3, 2026 22:04
@astral-sh-bot astral-sh-bot Bot requested a review from charliermarsh June 3, 2026 22:04
@carljm carljm merged commit 85207d3 into main Jun 4, 2026
59 checks passed
@carljm carljm deleted the cjm/fix-sys-implementation branch June 4, 2026 03:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ty Multi-file analysis & type inference

Projects

None yet

Development

Successfully merging this pull request may close these issues.

sys.implementation.version should not be assume to match sys.version_info

2 participants