-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
"E1130: bad operand type for unary -: ArrayImpl (invalid-unary-operand-type)" pylint errors in latest release (0.4.24) #19713
Comments
Hi - thanks for the report. Do you understand where pytype is inferring that I just double-checked that the pyi file is included in the v0.4.24 distribution, so I'm not sure why pytype would be ignoring it. Do you have any ideas? |
Thanks Jake for the prompt reply. No, I don't understand why pylint is doing that inference. A couple of more observations:
|
Workaround for jax-ml/jax#19713
Workaround for jax-ml/jax#19713
Workaround for jax-ml/jax#19713
Chatting with @superbobry, it seems this is coming from $ ls
mymodule.py mymodule.pyi test.py
$ cat mymodule.py
class Foo:
pass
setattr(Foo, "__neg__", lambda self: self)
$ cat mymodule.pyi
class Foo:
def __neg__(self) -> Foo: ...
$ cat test.py
"""Test file for incorrect E1130"""
from mymodule import Foo
result = -Foo()
$ mypy test.py
Success: no issues found in 1 source file
$ pylint test.py
************* Module test
test.py:3:9: E1130: bad operand type for unary -: Foo (invalid-unary-operand-type)
------------------------------------------------------------------
Your code has been rated at 0.00/10 (previous run: 0.00/10, +0.00) So in summary, this looks like a bug in What do you think? |
Thanks @jakevdp for reporting this upstream! I'll close the issue here since it does seem more of an issue in pylint |
Workaround for jax-ml/jax#19713
Description
Running pylint (
pylint test.py
) on this simple filefails with the latest release of jax (0.4.24) :
The same code doesn't raise any error with jax 0.4.23.
This has led to some tests failures in other packages such as optax
What jax/jaxlib version are you using?
0.4.24 0.4.24
Which accelerator(s) are you using?
CPU
Additional system info?
Tried on both linux and mac
NVIDIA GPU info
No response
The text was updated successfully, but these errors were encountered: