Skip to content

Add __name__ to _Wrapped in functools - #9835

Merged
AlexWaygood merged 4 commits into
python:mainfrom
tmke8:wrapped-name
Mar 3, 2023
Merged

Add __name__ to _Wrapped in functools#9835
AlexWaygood merged 4 commits into
python:mainfrom
tmke8:wrapped-name

Conversation

@tmke8

@tmke8tmke8 commented Mar 3, 2023

Copy link
Copy Markdown
Contributor

There can be scenarios where __name__ isn't set, as pointed out here: python/mypy#14815 (comment) but the same is true for Callable, so this has precedent.

Comment threadtest_cases/stdlib/check_functools.py Outdated
Comment threadtest_cases/stdlib/check_functools.py Outdated
Comment threadtest_cases/stdlib/check_functools.py Outdated
@github-actions

This comment has been minimized.

@tmke8

tmke8 commented Mar 3, 2023

Copy link
Copy Markdown
ContributorAuthor

Mypy primer looks as expected 🚀

@AlexWaygoodAlexWaygood left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM. @erictraut, does this make sense to you?

@github-actions

Copy link
Copy Markdown
Contributor

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

pandas (https://github.com/pandas-dev/pandas)
- pandas/core/strings/accessor.py:130: error: "_Wrapped[<nothing>, <nothing>, [Any, VarArg(Any), KwArg(Any)], Any]" has no attribute "__name__" [attr-defined]
spark (https://github.com/apache/spark)
- python/pyspark/sql/udf.py:428: error: "_Wrapped[[VarArg(Any), KwArg(Any)], Any, [VarArg(Union[Column, str])], Column]" has no attribute "__name__" [attr-defined]- python/pyspark/sql/connect/udf.py:159: error: "_Wrapped[[VarArg(Any), KwArg(Any)], Any, [VarArg(Union[Column, str])], Column]" has no attribute "__name__" [attr-defined]
streamlit (https://github.com/streamlit/streamlit)
- lib/streamlit/deprecation_util.py: note: In function "deprecate_func_name":- lib/streamlit/deprecation_util.py:81:5: error: "_Wrapped[<nothing>, <nothing>, [VarArg(Any), KwArg(Any)], Any]" has no attribute "__name__" [attr-defined]

@erictraut

Copy link
Copy Markdown
Contributor

Yeah, makes sense to me.

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.

3 participants

@tmke8@erictraut@AlexWaygood