Skip to content

Add function definition notes for too_many_positional_arguments errors#21410

Open
KevinRK29 wants to merge 1 commit intopython:masterfrom
KevinRK29:note-defined-here
Open

Add function definition notes for too_many_positional_arguments errors#21410
KevinRK29 wants to merge 1 commit intopython:masterfrom
KevinRK29:note-defined-here

Conversation

@KevinRK29
Copy link
Copy Markdown
Collaborator

@KevinRK29 KevinRK29 commented May 5, 2026

Followup to #20794

Adds the "foo" is defined in "bar" note for the too_many_positional_arguments error case

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 5, 2026

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

urllib3 (https://github.com/urllib3/urllib3)
+ test/with_dummyserver/test_poolmanager.py:659: note: "request" defined in "urllib3"
+ test/with_dummyserver/test_poolmanager.py:659: note: Error code "call-arg" not covered by "type: ignore[misc]" comment

core (https://github.com/home-assistant/core)
+ homeassistant/components/http/__init__.py:493: note: "HTTPRedirection" defined in "aiohttp.web_exceptions"
+ homeassistant/components/http/__init__.py:493: note: Error code "call-arg" not covered by "type: ignore[arg-type, misc]" comment

pandas-stubs (https://github.com/pandas-dev/pandas-stubs)
+ tests/test_string_accessors.py:226: note: "wrap" defined in "pandas.core.strings.accessor"
+ tests/test_string_accessors.py:226: note: Error code "call-arg" not covered by "type: ignore[misc]" comment
+ tests/test_string_accessors.py:284: note: "wrap" defined in "pandas.core.strings.accessor"
+ tests/test_string_accessors.py:284: note: Error code "call-arg" not covered by "type: ignore[misc]" comment

cryptography (https://github.com/pyca/cryptography)
+ tests/hazmat/primitives/test_kbkdf.py:358: note: "KBKDFHMAC" defined in "cryptography.hazmat.bindings._rust.openssl.kdf"
+ tests/hazmat/primitives/test_kbkdf.py:808: note: "KBKDFCMAC" defined in "cryptography.hazmat.bindings._rust.openssl.kdf"

xarray (https://github.com/pydata/xarray)
+ xarray/tests/test_groupby.py: note: In function "test_multiple_groupers_string":
+ xarray/tests/test_groupby.py:2980: note: "groupby" defined in "xarray.core.dataarray"
+ xarray/tests/test_groupby.py:2980: note: Error code "call-arg" not covered by "type: ignore[arg-type, misc]" comment
+ xarray/tests/test_groupby.py: note: At top level:

@KevinRK29 KevinRK29 marked this pull request as ready for review May 5, 2026 04:49
@KevinRK29 KevinRK29 requested review from JukkaL and ilevkivskyi May 5, 2026 04:49
Comment thread mypy/messages.py
@@ -972,6 +972,7 @@ def too_many_positional_arguments(self, callee: CallableType, context: Context)
msg = "Too many positional arguments" + for_function(callee)
self.fail(msg, context)
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Looking at the primer, I think I may need to change it to self.fail(msg, context, code=codes.CALL_ARG) similar to the error cases above?

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.

Usually we try to avoid changing the error code. But in this case this looks like an oversight. I leave this up to @JukkaL to decide.

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.

2 participants