Skip to content

[ty] Fix dict.pop overloads to accept arbitrary keys with defaults - #26241

Merged
carljm merged 1 commit into
mainfrom
cjm/3819-fix-dictpop-overload-false
Jun 22, 2026
Merged

carljm merged 1 commit into
mainfrom
cjm/3819-fix-dictpop-overload-false

Conversation

@carljm

@carljm carljm commented Jun 22, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Adjust dict.pop overloads in vendored typeshed so calls with a fallback value accept object keys, since those calls will never fail.

Follow-up to #25831 - same principle applies.

Closes astral-sh/ty#3819

Testing

Added mdtests.

@astral-sh-bot astral-sh-bot Bot added the ty The ty type checker label Jun 22, 2026
@astral-sh-bot astral-sh-bot Bot changed the title Fix dict.pop overloads to accept arbitrary keys with defaults [ty] Fix dict.pop overloads to accept arbitrary keys with defaults Jun 22, 2026
@astral-sh-bot

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

@carljm
carljm marked this pull request as ready for review June 22, 2026 18:40
@carljm
carljm requested review from a team as code owners June 22, 2026 18:40
@astral-sh-bot
astral-sh-bot Bot requested a review from dhruvmanila June 22, 2026 18:40
@astral-sh-bot

astral-sh-bot Bot commented Jun 22, 2026

Copy link
Copy Markdown

Memory usage report

Memory usage unchanged ✅

@astral-sh-bot

astral-sh-bot Bot commented Jun 22, 2026

Copy link
Copy Markdown

ecosystem-analyzer results

Lint rule Added Removed Changed
no-matching-overload 0 13 0
invalid-method-override 6 0 0
unused-type-ignore-comment 2 0 0
Total 8 13 0

Flaky changes detected. This PR summary excludes flaky changes; see the HTML report for details.

Raw diff (21 changes)
apprise (https://github.com/caronc/apprise)
- apprise/config/base.py:1273:21 error[no-matching-overload] No overload of bound method `dict.pop` matches arguments

beartype (https://github.com/beartype/beartype)
- beartype/_check/convert/_reduce/_pep/pep646/redpep484612646typearg.py:278:32 error[no-matching-overload] No overload of bound method `dict.pop` matches arguments

dd-trace-py (https://github.com/DataDog/dd-trace-py)
- ddtrace/contrib/internal/ray/span_manager.py:244:21 error[no-matching-overload] No overload of bound method `dict.pop` matches arguments
- ddtrace/contrib/internal/ray/span_manager.py:247:13 error[no-matching-overload] No overload of bound method `dict.pop` matches arguments

discord.py (https://github.com/Rapptz/discord.py)
+ discord/ui/view.py:986:64 warning[unused-type-ignore-comment] Unused blanket `type: ignore` directive

django-stubs (https://github.com/typeddjango/django-stubs)
+ django-stubs/contrib/sessions/backends/base.pyi:38:9 error[invalid-method-override] Invalid override of method `pop`: Definition is incompatible with `dict.pop`

mongo-python-driver (https://github.com/mongodb/mongo-python-driver)
+ bson/son.py:138:9 error[invalid-method-override] Invalid override of method `pop`: Definition is incompatible with `dict.pop`

mypy (https://github.com/python/mypy)
+ mypy/typeshed/stdlib/collections/__init__.pyi:412:9 error[invalid-method-override] Invalid override of method `pop`: Definition is incompatible with `dict.pop`

pandas (https://github.com/pandas-dev/pandas)
- pandas/core/generic.py:3671:31 error[no-matching-overload] No overload of bound method `dict.pop` matches arguments
- pandas/core/generic.py:3672:32 error[no-matching-overload] No overload of bound method `dict.pop` matches arguments

pwndbg (https://github.com/pwndbg/pwndbg)
- pwndbg/aglib/disasm/disassembly.py:91:5 error[no-matching-overload] No overload of bound method `dict.pop` matches arguments
- pwndbg/aglib/disasm/disassembly.py:92:5 error[no-matching-overload] No overload of bound method `dict.pop` matches arguments

rotki (https://github.com/rotki/rotki)
- rotkehlchen/chain/aggregator.py:794:17 error[no-matching-overload] No overload of bound method `dict.pop` matches arguments
- rotkehlchen/chain/aggregator.py:794:17 error[no-matching-overload] No overload of bound method `dict.pop` matches arguments
- rotkehlchen/chain/aggregator.py:794:17 error[no-matching-overload] No overload of bound method `dict.pop` matches arguments
- rotkehlchen/chain/aggregator.py:794:17 error[no-matching-overload] No overload of bound method `dict.pop` matches arguments
- rotkehlchen/chain/aggregator.py:794:17 error[no-matching-overload] No overload of bound method `dict.pop` matches arguments
+ rotkehlchen/chain/aggregator.py:988:50 warning[unused-type-ignore-comment] Unused blanket `type: ignore` directive

starlette (https://github.com/encode/starlette)
+ starlette/middleware/sessions.py:114:9 error[invalid-method-override] Invalid override of method `pop`: Definition is incompatible with `dict.pop`

werkzeug (https://github.com/pallets/werkzeug)
+ src/werkzeug/datastructures/mixins.py:271:9 error[invalid-method-override] Invalid override of method `pop`: Definition is incompatible with `dict.pop`
+ src/werkzeug/datastructures/structures.py:477:9 error[invalid-method-override] Invalid override of method `pop`: Definition is incompatible with `dict.pop`

Full report with detailed diff (timing results)

@carljm
carljm merged commit 1b011de into main Jun 22, 2026
61 checks passed
@carljm
carljm deleted the cjm/3819-fix-dictpop-overload-false branch June 22, 2026 19:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ty The ty type checker

Projects

None yet

Development

Successfully merging this pull request may close these issues.

dict.pop() causes no-matching-overload

2 participants