Skip to content

Make BaseException.__new__ cls positional-only#16066

Merged
JelleZijlstra merged 1 commit into
python:mainfrom
carljm:cjm/baseexception-new-positional-only
Jul 22, 2026
Merged

Make BaseException.__new__ cls positional-only#16066
JelleZijlstra merged 1 commit into
python:mainfrom
carljm:cjm/baseexception-new-positional-only

Conversation

@carljm

@carljm carljm commented Jul 22, 2026

Copy link
Copy Markdown
Member

Make the cls parameter of BaseException.__new__ positional-only. CPython accepts BaseException.__new__(Exception, cls=int) and rejects BaseException.__new__(cls=Exception), so the existing positional-or-keyword annotation incorrectly treats a valid cls keyword forwarded through **kwds as a duplicate argument.

@github-actions

Copy link
Copy Markdown
Contributor

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

@carljm
carljm marked this pull request as ready for review July 22, 2026 01:43
@JelleZijlstra
JelleZijlstra merged commit 1cb63c8 into python:main Jul 22, 2026
73 checks passed
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