Skip to content

Revert dict.__or__ typeshed change#21186

Open
ilevkivskyi wants to merge 1 commit intopython:masterfrom
ilevkivskyi:revert-dict-or
Open

Revert dict.__or__ typeshed change#21186
ilevkivskyi wants to merge 1 commit intopython:masterfrom
ilevkivskyi:revert-dict-or

Conversation

@ilevkivskyi
Copy link
Copy Markdown
Member

Fixes #21141

I am not sure how typeshed patches work. If possible, I would add some tests here, otherwise I will add tests in a follow-up PR.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 7, 2026

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

artigraph (https://github.com/artigraph/artigraph)
- tests/arti/internal/test_mappings.py:40: error: Unsupported operand types for | ("dict[str, int]" and "frozendict[Never, int]")  [operator]
+ tests/arti/internal/test_mappings.py:40: error: No overload variant of "__or__" of "dict" matches argument type "frozendict[Never, int]"  [operator]
+ tests/arti/internal/test_mappings.py:40: note: Possible overload variants:
+ tests/arti/internal/test_mappings.py:40: note:     def __or__(self, dict[str, int], /) -> dict[str, int]
+ tests/arti/internal/test_mappings.py:40: note:     def [_T1, _T2] __or__(self, dict[_T1, _T2], /) -> dict[str | _T1, int | _T2]

rotki (https://github.com/rotki/rotki)
- rotkehlchen/chain/evm/decoding/aave/v3/decoder.py:583: error: Unused "type: ignore" comment  [unused-ignore]

@cdce8p
Copy link
Copy Markdown
Collaborator

cdce8p commented Apr 8, 2026

I am not sure how typeshed patches work.

You'll need to add the patch to misc/typeshed_patches. Afterwards, it will be picked up for any subsequent typeshed sync.

git format-patch -1 -o misc/typeshed_patches/ HEAD

If possible, I would add some tests here, otherwise I will add tests in a follow-up PR.

I believe the pythoneval.test tests are run using the full stubs, so you should be able to a regression test there. You can do that in this PR as well, no need to create a separate one for it.

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.

[1.20 regression] "Unsupported operand types for |" with recursive type definition

2 participants