Skip to content

fix(weakref): make proxy return ProxyType[_T] for non-callable _T#15965

Open
pddshk wants to merge 1 commit into
python:mainfrom
pddshk:main
Open

fix(weakref): make proxy return ProxyType[_T] for non-callable _T#15965
pddshk wants to merge 1 commit into
python:mainfrom
pddshk:main

Conversation

@pddshk

@pddshk pddshk commented Jun 29, 2026

Copy link
Copy Markdown

In #5166 it was possibly overseen that proxy returns Any for non-callable argument. This PR fixes this behavior

Signed-off-by: Pavel Dydyshka <paul.dydyshko@gmail.com>
@github-actions

Copy link
Copy Markdown
Contributor

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

operator (https://github.com/canonical/operator)
+ ops/model.py:1953: error: Argument 1 to "RelationDataContent" has incompatible type "ProxyType[Relation]"; expected "Relation"  [arg-type]
+ ops/model.py:1954: error: Argument 1 to "RelationDataContent" has incompatible type "ProxyType[Relation]"; expected "Relation"  [arg-type]
+ ops/model.py:1957: error: Argument 1 to "RelationDataContent" has incompatible type "ProxyType[Relation]"; expected "Relation"  [arg-type]
+ ops/model.py:1962: error: Argument 1 to "RelationDataContent" has incompatible type "ProxyType[Relation]"; expected "Relation"  [arg-type]
+ ops/model.py:1966: error: Argument 1 to "RelationDataContent" has incompatible type "ProxyType[Relation]"; expected "Relation"  [arg-type]
+ ops/framework.py:390: error: Incompatible types in assignment (expression has type "ProxyType[Framework]", variable has type "Framework")  [assignment]

jinja (https://github.com/pallets/jinja)
+ src/jinja2/loaders.py:641: error: Incompatible types in assignment (expression has type "ProxyType[_TemplateModule]", target has type Module)  [assignment]

mongo-python-driver (https://github.com/mongodb/mongo-python-driver)
+ pymongo/periodic_executor.py:188: error: Incompatible types in assignment (expression has type "ProxyType[Thread]", variable has type "Thread | None")  [assignment]

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 participant