Skip to content

Fix metaclass issues in the type stubs - #787

Merged
amoffat merged 2 commits into
amoffat:developfrom
jorenham:typing/metaclass-fixes
Jul 21, 2026
Merged

amoffat merged 2 commits into
amoffat:developfrom
jorenham:typing/metaclass-fixes

Conversation

@jorenham

Copy link
Copy Markdown
Contributor

Continuing the typing pilgrimage that started at #785, this takes care of the largest class of stubtest errors, bringing the total of 357 errors down to 34.

Before:

$ stubtest sh
<errors omitted for sanity>
Found 357 errors (checked 1 module)

After:

$ stubtest sh
<errors omitted for sanity>
Found 34 errors (checked 1 module)

🧙

@amoffat

amoffat commented Jul 21, 2026

Copy link
Copy Markdown
Owner

What does the metaclass enable/fix in a stub file?

@jorenham

Copy link
Copy Markdown
Contributor Author

What does the metaclass enable/fix in a stub file?

It's mostly a correctness thing; stubs should accurately describe the runtime situation, including metaclasses.

It might make a difference in type-safety in case of __slots__, but I doubt that'll be relevant here.

So TBH, it's mostly to appease stubtest. The alternative would be to manually add these to the stubtest "allowlist" (a list of ignored errors), which sounds like more work than simply adding these metaclasses 🤷

@amoffat
amoffat merged commit 4288fce into amoffat:develop Jul 21, 2026
23 checks passed
@jorenham
jorenham deleted the typing/metaclass-fixes branch July 21, 2026 19:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants