Skip to content

Conversation

@tungol
Copy link
Contributor

a few issues exposed after python/mypy#18259 was merged

@tungoltungol marked this pull request as draft August 22, 2025 11:43
@github-actions

This comment has been minimized.

@tungol
Copy link
ContributorAuthor

tungol commented Aug 22, 2025

The failure is pyright noticing that random.Random.__init__ and random.Random.__new__ don't match on 3.9. Most critically, _random.Random.__new__ is positional only, but only if it's passed _random.Random.

>>> _random.Random.__new__(random.Random, x=1) <random.Random object at 0x15c009010> >>> random.Random.__new__(random.Random, x=1) <random.Random object at 0x14a808210> 

but

>>> _random.Random.__new__(_random.Random, x=1) Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: Random()() takes no keyword arguments >>> random.Random.__new__(_random.Random, x=1) Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: Random()() takes no keyword arguments 

I'm not sure what the best approach to this is.

That said, looking at the code, while it accepts the kwarg when passed random.Random, it doesn't actually use it.

@tungoltungol changed the title C sigsfix up some C signaturesAug 22, 2025
@github-actions
Copy link
Contributor

Diff from mypy_primer, showing the effect of this PR on open source code:

discord.py (https://github.com/Rapptz/discord.py) - discord/ext/commands/hybrid.py:834: error: Overlap between argument names and ** TypedDict items: "with_app_command", "name" [misc]+ discord/ext/commands/hybrid.py:834: error: Overlap between argument names and ** TypedDict items: "name", "with_app_command" [misc]- discord/ext/commands/hybrid.py:858: error: Overlap between argument names and ** TypedDict items: "with_app_command", "name" [misc]+ discord/ext/commands/hybrid.py:858: error: Overlap between argument names and ** TypedDict items: "name", "with_app_command" [misc]- discord/ext/commands/hybrid.py:883: error: Overlap between argument names and ** TypedDict items: "with_app_command", "name" [misc]+ discord/ext/commands/hybrid.py:883: error: Overlap between argument names and ** TypedDict items: "name", "with_app_command" [misc]- discord/ext/commands/hybrid.py:935: error: Overlap between argument names and ** TypedDict items: "with_app_command", "name" [misc]+ discord/ext/commands/hybrid.py:935: error: Overlap between argument names and ** TypedDict items: "name", "with_app_command" [misc]- discord/ext/commands/bot.py:290: error: Overlap between argument names and ** TypedDict items: "with_app_command", "name" [misc]+ discord/ext/commands/bot.py:290: error: Overlap between argument names and ** TypedDict items: "name", "with_app_command" [misc]- discord/ext/commands/bot.py:314: error: Overlap between argument names and ** TypedDict items: "with_app_command", "name" [misc]+ discord/ext/commands/bot.py:314: error: Overlap between argument names and ** TypedDict items: "name", "with_app_command" [misc]

@tungoltungol marked this pull request as ready for review August 22, 2025 12:41
@JelleZijlstraJelleZijlstra merged commit cc14cc6 into python:mainAug 22, 2025
66 checks passed
@JelleZijlstra
Copy link
Member

Thank you!

@JelleZijlstra
Copy link
Member

@tungol there's some more here https://github.com/python/typeshed/actions/runs/17160218615/job/48687325575?pr=14599, I think they're new in 3.14.

@tungoltungol deleted the C_sigs branch September 2, 2025 21:31
Sign up for freeto 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

@tungol@JelleZijlstra