Skip to content

Add collections.deque.__rmul__#16055

Merged
srittau merged 2 commits into
python:mainfrom
jason-scheffel:fix/deque-rmul
Jul 21, 2026
Merged

Add collections.deque.__rmul__#16055
srittau merged 2 commits into
python:mainfrom
jason-scheffel:fix/deque-rmul

Conversation

@jason-scheffel

Copy link
Copy Markdown
Contributor

Fixes #16034.

Add deque.__rmul__ and a regression test for 3 * deque([1, 2, 3]).

Stubtest does not detect the missing method because deque.__rmul__ is a
WrapperDescriptorType, and stubtest intentionally ignores missing stub
entries for runtime wrapper descriptors with dunder names.

@github-actions

This comment has been minimized.

@srittau srittau left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, but please remove the test case. For various reasons, we only use test cases for especially hard to type corner cases.

Declare `deque.__rmul__` so type checkers accept multiplication with
an integer on the left.

Refs: python#16034
Signed-off-by: Jason Scheffel <contact@jasonscheffel.com>
@jason-scheffel

Copy link
Copy Markdown
Contributor Author

Removed the test case.

@github-actions

This comment has been minimized.

@srittau

srittau commented Jul 21, 2026

Copy link
Copy Markdown
Collaborator

CI failures are unrelated, but let's wait for #16060 to be merged to be safe.

@github-actions

Copy link
Copy Markdown
Contributor

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

@srittau
srittau merged commit d0d2a7e into python:main Jul 21, 2026
73 checks passed
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.

collections.deque.__rmul__ is missing

2 participants