GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Use standard formatting for note on unexpected keyword by ilevkivskyi · Pull Request #20808 · python/mypy

Conversation

@ilevkivskyi

@ilevkivskyi ilevkivskyi commented Feb 13, 2026

Copy link
Copy Markdown
Member

Closes #4773
Closes #10480
Closes #20640

Currently this is the only message that uses this non-standard formatting, while:

  • Some users find it confusing
  • We need ~400 lines of code to support this special case
  • It still has bugs that will require even more special-casing in various places to fix them.

So here I implement a minimal change I propose in #4773, namely use this (standard) format:

main.py:5: error: Unexpected keyword argument "location" for "method" of "Class"
main.py:5: note: "method" defined in "pkg.mod"

if the function is defined in a different module.

If we want to, we can add extra info (like available argument names with same type), as well as start using this note in more places in separate PRs.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@ilevkivskyi
Use standard formatting for note on unexpected keyword
ad3659b
@ilevkivskyi
ilevkivskyi requested review from JukkaL and hauntsaninja February 13, 2026 22:42
@github-actions

This comment has been minimized.

Sign in to view
@ilevkivskyi

ilevkivskyi commented Feb 13, 2026

Copy link
Copy Markdown
Member Author

Hm, looking at the mypy_primer output I think we should skip this note for builtins and typing, it doesn't look very helpful.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@ilevkivskyi
Skip the note in builtins and typing
4a30cc5
@github-actions

github-actions Bot commented Feb 13, 2026

Copy link
Copy Markdown
Contributor

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

prefect (https://github.com/PrefectHQ/prefect)
- ...venv/lib/python3.14/site-packages/mypy/typeshed/stdlib/builtins.pyi:139: note: "__init_subclass__" of "object" defined here
- ...venv/lib/python3.14/site-packages/mypy/typeshed/stdlib/builtins.pyi:139: note: "__init_subclass__" of "object" defined here
+ src/prefect/states.py:581: note: "resolve_result_storage" defined in "prefect.results"
- src/prefect/results.py:166: note: "resolve_result_storage" defined here
- ...venv/lib/python3.14/site-packages/mypy/typeshed/stdlib/builtins.pyi:139: note: "__init_subclass__" of "object" defined here
- src/prefect/blocks/core.py:1545: note: "register_type_and_schema" of "Block" defined here
+ src/prefect/results.py:183: note: "load" defined in "prefect.blocks.core"
- src/prefect/blocks/core.py:1137: note: "load" of "Block" defined here
- src/prefect/results.py:104: note: "get_default_result_storage" defined here
- src/prefect/results.py:166: note: "resolve_result_storage" defined here
- ...venv/lib/python3.14/site-packages/mypy/typeshed/stdlib/builtins.pyi:139: note: "__init_subclass__" of "object" defined here
+ src/prefect/flows.py:601: note: "load_from_ref" defined in "prefect.blocks.core"
- src/prefect/blocks/core.py:1302: note: "load_from_ref" of "Block" defined here
- src/prefect/deployments/runner.py:1250: note: "from_storage" of "RunnerDeployment" defined here
+ src/prefect/flows.py:946: note: "from_storage" defined in "prefect.deployments.runner"
- src/prefect/results.py:166: note: "resolve_result_storage" defined here
+ src/prefect/flows.py:2548: note: "resolve_result_storage" defined in "prefect.results"
- ...venv/lib/python3.14/site-packages/mypy/typeshed/stdlib/builtins.pyi:139: note: "__init_subclass__" of "object" defined here
- src/prefect/results.py:397: note: "update_for_flow" of "ResultStore" defined here
+ src/prefect/flow_engine.py:493: note: "update_for_flow" defined in "prefect.results"
+ src/prefect/flow_engine.py:813: note: "update_for_flow" defined in "prefect.results"
+ src/prefect/flow_engine.py:1097: note: "update_for_flow" defined in "prefect.results"
+ src/prefect/flow_engine.py:1414: note: "update_for_flow" defined in "prefect.results"
+ src/prefect/task_engine.py:777: note: "update_for_task" defined in "prefect.results"
- src/prefect/results.py:473: note: "update_for_task" of "ResultStore" defined here
- src/prefect/artifacts.py:84: note: "create" of "Artifact" defined here
- src/prefect/artifacts.py:151: note: "get" of "Artifact" defined here
- src/prefect/artifacts.py:248: note: "format" of "Artifact" defined here
- src/prefect/artifacts.py:334: note: "format" of "ProgressArtifact" defined here

pydantic (https://github.com/pydantic/pydantic)
- ...venv/lib/python3.14/site-packages/mypy/typeshed/stdlib/typing.pyi:1065: note: "evaluate_forward_ref" defined here
- .../projects/_pydantic_venv/lib/python3.14/site-packages/pydantic_core/_pydantic_core.pyi:76: note: "SchemaValidator" defined here
+ pydantic/plugin/_schema_validator.py:53: note: "SchemaValidator" defined in "pydantic_core._pydantic_core"
+ pydantic/plugin/_schema_validator.py:72: note: "SchemaValidator" defined in "pydantic_core._pydantic_core"
- .../projects/_pydantic_venv/lib/python3.14/site-packages/pydantic_core/_pydantic_core.pyi:300: note: "SchemaSerializer" defined here
+ pydantic/_internal/_model_construction.py:694: note: "SchemaSerializer" defined in "pydantic_core._pydantic_core"

starlette (https://github.com/encode/starlette)
- starlette/websockets.py:21: note: "WebSocketDenialResponse" defined here
+ starlette/testclient.py:155: note: "WebSocketDenialResponse" defined in "starlette.websockets"

zulip (https://github.com/zulip/zulip)
- ...venv/lib/python3.14/site-packages/mypy/typeshed/stdlib/builtins.pyi:117: note: "SubTest" defined here
- ...venv/lib/python3.14/site-packages/mypy/typeshed/stdlib/builtins.pyi:117: note: "SubmessageFixture" defined here
- ...venv/lib/python3.14/site-packages/mypy/typeshed/stdlib/builtins.pyi:117: note: "FileFixture" defined here

strawberry (https://github.com/strawberry-graphql/strawberry)
- ...venv/lib/python3.14/site-packages/mypy/typeshed/stdlib/builtins.pyi:139: note: "__init_subclass__" of "object" defined here

core (https://github.com/home-assistant/core)
- ...venv/lib/python3.14/site-packages/mypy/typeshed/stdlib/builtins.pyi:139: note: "__init_subclass__" of "object" defined here
- ...venv/lib/python3.14/site-packages/mypy/typeshed/stdlib/builtins.pyi:139: note: "__init_subclass__" of "object" defined here

aiortc (https://github.com/aiortc/aiortc)
- .../projects/_aiortc_venv/lib/python3.14/site-packages/OpenSSL-stubs/SSL.pyi:144: note: "get_peer_certificate" of "Connection" defined here
+ src/aiortc/rtcdtlstransport.py:437: note: "get_peer_certificate" defined in "OpenSSL.SSL"

discord.py (https://github.com/Rapptz/discord.py)
- ...venv/lib/python3.14/site-packages/mypy/typeshed/stdlib/typing.pyi:1046: note: "update" of "TypedDict" defined here

ibis (https://github.com/ibis-project/ibis)
- ...venv/lib/python3.14/site-packages/mypy/typeshed/stdlib/builtins.pyi:117: note: "Any" defined here
- ibis/expr/operations/generic.py:145: note: "Literal" defined here
+ ibis/expr/operations/tests/test_generic.py:112: note: "Literal" defined in "ibis.expr.operations.generic"
- ...venv/lib/python3.14/site-packages/mypy/typeshed/stdlib/builtins.pyi:117: note: "__init__" of "object" defined here

apprise (https://github.com/caronc/apprise)
- ...venv/lib/python3.14/site-packages/mypy/typeshed/stdlib/builtins.pyi:117: note: "IRCMessage" defined here
- ...venv/lib/python3.14/site-packages/mypy/typeshed/stdlib/builtins.pyi:117: note: "IRCAction" defined here
- ...venv/lib/python3.14/site-packages/mypy/typeshed/stdlib/builtins.pyi:117: note: "IRCContext" defined here
- ...venv/lib/python3.14/site-packages/mypy/typeshed/stdlib/builtins.pyi:117: note: "IRCContext" defined here
- ...venv/lib/python3.14/site-packages/mypy/typeshed/stdlib/builtins.pyi:117: note: "XMPPConfig" defined here
- ...venv/lib/python3.14/site-packages/mypy/typeshed/stdlib/builtins.pyi:117: note: "IRCContext" defined here
- ...venv/lib/python3.14/site-packages/mypy/typeshed/stdlib/builtins.pyi:117: note: "IRCAction" defined here
- ...venv/lib/python3.14/site-packages/mypy/typeshed/stdlib/builtins.pyi:117: note: "XMPPConfig" defined here
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

hauntsaninja
hauntsaninja approved these changes Feb 13, 2026
View reviewed changes

@hauntsaninja hauntsaninja left a comment •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Collaborator

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Nice! Great that this is so much cleaner too

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@ilevkivskyi
ilevkivskyi merged commit b8b50b1 into python:master Feb 14, 2026
23 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@ilevkivskyi
ilevkivskyi deleted the defined-here-standard branch February 14, 2026 13:06
@ilevkivskyi ilevkivskyi mentioned this pull request Feb 14, 2026
Add function definition notes for missing_named_argument errors #20794
Merged
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@hauntsaninja hauntsaninja hauntsaninja approved these changes
@JukkaL JukkaL Awaiting requested review from JukkaL

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Show relative error location for function aliases note: is orphaned from actual error if there are other problems between it Add "<function> defined here" notes to more errors

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@ilevkivskyi @hauntsaninja
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.