-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
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
TYP: fix missing sys
import in numeric.pyi
#26788
Conversation
It would be nice to have this tested somehow so there is a test that fails without the fix, and passes afterwards. |
Without this fix stub file had an error Regarding |
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.
Thanks @Andrej730.
Re testing: I don't think we can do anything about that. We test with Mypy (3 platforms, 3 different Python versions) , so this code is exercised. If different type checkers disagree, there's not much we can do. In this case, PyLance's complaint clearly seems correct; not sure why Mypy is happy with the missing import.
In this case, the problematic if-else can be removed completely though, because 3.10 is the lowest Python version we support now. @Andrej730 could you please do that instead?
sys
import in numeric.pyisys
import in numeric.pyi
Or one better, revert all of commit 8de2ed5. |
As 3.10 now is the minimum required version for numpy
Removed the
It seems something is missing - maybe this file is skipped somehow during tests or mypy configured to skip missing symbols? Line 18 in 7687245
|
I have no time to dig into the mystery of why CI doesn't complain right now unfortunately, but I'd be happy to merge this.
Good catch. Would you mind fixing that up as well? |
It's okay to just remove it as it wasn't really used in the code either way.
Sure, done. |
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.
LGTM, in it goes. Thanks @Andrej730!
Motivated by numpy#26788, but we cannot employ that fix directly as NumPy 2.0.x still support Python 3.9.
Motivated by numpy#26788, but we cannot employ that fix directly as NumPy 2.0.x still support Python 3.9.
Fixed missing
sys
import that's needed after 8de2ed5 for these lines to work:numpy/numpy/_core/numeric.pyi
Lines 11 to 14 in 7687245
Perhaps, ping @rgommers