Too tight a type constraint on ExceptionInfo.errisinstance #12667
Labels
topic: typing
type-annotation issue
type: regression
indicates a problem that was introduced in a release which was working previously
pip list
from the virtual environment you are usingWith pytest 8.2.2 the declaration of
ExceptionInfo.errisinstance
wasWith 8.3.1, this has changed, first by introducing a type spec, and then using that typespec for the function signature
Version 8.2.2 would pass a
mypy
check with the following reproducer. Version 8.3.1 fails (I didn't test with 8.3.0 but I'd expect that to also fail). I tested this with mypy versions 1.10.1 and 1.11.0, but I'd expect it to fail for pretty much any supported version of mypy.The change was made in this commit but I'm not finding an explanation there as to why the type was changed from
BaseException
toException
.To me, it looks like the best fix is to change EXCEPTION_OR_MORE to
restoring backward compatibility.
The text was updated successfully, but these errors were encountered: