-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Simplify bool
stub
#6782
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Simplify bool
stub
#6782
Conversation
The semantics of this proposed PR should be identical to the existing stub. I'm curious, though, to see whether primer shows false-positives like those we saw in python#6762
Diff from mypy_primer, showing the effect of this PR on open source code: pandas (https://github.com/pandas-dev/pandas)
+ pandas/core/ops/mask_ops.py:58: error: Value of type variable "_B" of "__or__" of "bool" cannot be "ndarray[Any, Any]" [type-var]
+ pandas/core/ops/mask_ops.py:181: error: Value of type variable "_B" of "__or__" of "bool" cannot be "ndarray[Any, Any]" [type-var]
+ pandas/core/groupby/indexing.py:163: error: Value of type variable "_B" of "__or__" of "bool" cannot be "ndarray[Any, dtype[bool_]]" [type-var]
+ pandas/core/groupby/indexing.py:166: error: Value of type variable "_B" of "__or__" of "bool" cannot be "ndarray[Any, dtype[bool_]]" [type-var]
+ pandas/core/groupby/indexing.py:175: error: Value of type variable "_B" of "__or__" of "bool" cannot be "ndarray[Any, Any]" [type-var]
+ pandas/core/groupby/indexing.py:177: error: Value of type variable "_B" of "__or__" of "bool" cannot be "Union[bool, ndarray[Any, Any]]" [type-var]
|
I'll take a look at the |
@@ -75,6 +75,7 @@ _TBE = TypeVar("_TBE", bound="BaseException") | |||
_R = TypeVar("_R") # Return-type TypeVar | |||
_SupportsNextT = TypeVar("_SupportsNextT", bound=SupportsNext[Any], covariant=True) | |||
_SupportsAnextT = TypeVar("_SupportsAnextT", bound=SupportsAnext[Any], covariant=True) | |||
_B = TypeVar("_B", bool, int) |
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.
In my experience mypy
does not have ideal support for TypeVars with values (and bugs in this field are really hard to fix!). It might be the root cause in pandas
case.
Also marking as "deferred" due to mypy problems. |
Agreed, this definitely shouldn't be merged until the errors identified in #6762 are resolved (if at all). |
This is likely the exact same thing as python/mypy#11880 from the other day |
Seems like this causes new false positives and doesn't actually solve any problem, so maybe we should just close this. (Trying to keep down the list of open PRs.) |
The semantics of this proposed revision should be identical to the existing stub. I'm curious, though, to see whether primer shows false-positives like those we saw in #6762