Skip to content

Conversation

srittau
Copy link
Collaborator

@srittau srittau commented Oct 2, 2025

Mark two exception name arguments as being potentially None

Copy link
Contributor

github-actions bot commented Oct 2, 2025

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

pydantic (https://github.com/pydantic/pydantic)
+ pydantic/errors.py:131: error: Argument "name" to "PydanticUndefinedAnnotation" has incompatible type "str | None"; expected "str"  [arg-type]

@srittau
Copy link
Collaborator Author

srittau commented Oct 2, 2025

The primer fallout is smaller than expected. We could use str | MaybeNone for the attributes of AttributeError and ImportError, but considering the low primer fallout, consistency with NameError (which always used str | None), and type safety I suggest we keep str | None.

@srittau srittau merged commit bee1e1f into python:main Oct 2, 2025
63 checks passed
@srittau srittau deleted the builtin-defaults branch October 2, 2025 12:56
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