Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[ty] Preserve metaclasses when inheriting from intersection-typed bases#26145

Merged
charliermarsh merged 1 commit into
mainfrom
cjm/3282-intersection-metaclass-handling
Jun 19, 2026
Merged

[ty] Preserve metaclasses when inheriting from intersection-typed bases#26145
charliermarsh merged 1 commit into
mainfrom
cjm/3282-intersection-metaclass-handling

Conversation

@carljm

@carljm carljm commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

Summary

Resolve bases for metaclass finding using the same rules as MRO construction. This avoids dropping inherited metaclasses when inheriting from an intersection.

Closes astral-sh/ty#3282

Testing

Added semantic regression coverage in metaclass.md.

@astral-sh-bot astral-sh-bot Bot added the ty Multi-file analysis & type inference label Jun 19, 2026
@astral-sh-bot astral-sh-bot Bot changed the title Preserve metaclasses when inheriting from intersection-typed bases [ty] Preserve metaclasses when inheriting from intersection-typed bases Jun 19, 2026
@astral-sh-bot

astral-sh-bot Bot commented Jun 19, 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 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.

@astral-sh-bot

astral-sh-bot Bot commented Jun 19, 2026

Copy link
Copy Markdown

Memory usage report

Summary

Project Old New Diff Outcome
prefect 524.30MB 524.31MB +0.00% (10.46kB)
flake8 31.35MB 31.36MB +0.01% (2.64kB)
trio 78.59MB 78.58MB -0.01% (5.85kB) ⬇️
sphinx 195.81MB 195.80MB -0.00% (8.54kB) ⬇️

Significant changes

Click to expand detailed breakdown

prefect

Name Old New Diff Outcome
parsed_module 19.35MB 19.36MB +0.05% (9.56kB)
try_metaclass_inner 809.01kB 809.62kB +0.08% (624.00B)
inheritance_cycle_inner 252.98kB 253.28kB +0.12% (300.00B)

flake8

Name Old New Diff Outcome
parsed_module 9.76MB 9.77MB +0.02% (2.11kB)
try_metaclass_inner 31.33kB 31.80kB +1.50% (480.00B)
inheritance_cycle_inner 10.05kB 10.11kB +0.58% (60.00B)

trio

Name Old New Diff Outcome
parsed_module 15.04MB 15.03MB -0.04% (6.06kB) ⬇️
inheritance_cycle_inner 30.93kB 31.04kB +0.38% (120.00B) ⬇️
try_metaclass_inner 100.81kB 100.91kB +0.09% (96.00B) ⬇️

sphinx

Name Old New Diff Outcome
parsed_module 18.37MB 18.36MB -0.05% (10.12kB) ⬇️
try_metaclass_inner 238.38kB 239.52kB +0.48% (1.14kB) ⬇️
infer_definition_types 19.56MB 19.56MB +0.00% (128.00B) ⬇️
inheritance_cycle_inner 75.12kB 75.23kB +0.16% (120.00B) ⬇️
StaticClassLiteral<'db>::own_fields_ 30.70kB 30.76kB +0.20% (64.00B) ⬇️
code_generator_of_static_class 175.70kB 175.76kB +0.04% (64.00B) ⬇️
StaticClassLiteral<'db>::try_mro_ 2.48MB 2.48MB +0.00% (48.00B) ⬇️
is_typed_dict_inner 120.18kB 120.21kB +0.03% (36.00B) ⬇️

@astral-sh-bot

astral-sh-bot Bot commented Jun 19, 2026

Copy link
Copy Markdown

ecosystem-analyzer results

No diagnostic changes detected ✅

Full report with detailed diff (timing results)

@carljm carljm marked this pull request as ready for review June 19, 2026 00:24
@carljm carljm requested a review from a team as a code owner June 19, 2026 00:24
@astral-sh-bot astral-sh-bot Bot requested a review from sharkdp June 19, 2026 00:24
@charliermarsh charliermarsh merged commit 6a41e5c into main Jun 19, 2026
60 checks passed
@charliermarsh charliermarsh deleted the cjm/3282-intersection-metaclass-handling branch June 19, 2026 03:17
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.

Support finding metaclasses from intersection-typed bases

2 participants