You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
bool is a subclass of int so this is not really an issue per se IMO. They can be considered as 0 or 1. I don't think we should have a dedicated if isinstance(x, bool) just to raise an appropriate error.
I don't think we need to make those functions entirely fool-proof for any kind of int-subclasses. There is a trade-off between practicability and purity IMO.
I'm going to close this as this is just part of the cost of bool being a subclass of int and there's no way we can (or will) sprinkle type checks for bool everywhere int is acceptable. Your best option is to have your linter detect this sort of thing.
Bug report
Bug description:
Setting the
float
value3.14
tolineno
argument of warnings.filterwarnings() and warnings.simplefilter() gets the error message as shown below:But setting the
bool
valuesTrue
andFalse
tolineno
argument ofwarnings.filterwarnings()
andwarnings.simplefilter()
works as shown below:CPython versions tested on:
3.12
Operating systems tested on:
Windows
The text was updated successfully, but these errors were encountered: