-
-
Notifications
You must be signed in to change notification settings - Fork 11k
MAINT: Enable linting with ruff E501 #29250
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
base: main
Are you sure you want to change the base?
Conversation
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.
I picked some nits; hope you don't mind.
Co-authored-by: Joren Hammudoglu <jhammudoglu@gmail.com>
@@ -294,13 +294,17 @@ def test_exceptions(self): | |||
assert_raises(ValueError, concatenate, ()) | |||
|
|||
@pytest.mark.slow | |||
@pytest.mark.skipif(sys.maxsize < 2**32, reason="only problematic on 64bit platforms") | |||
@pytest.mark.skipif( | |||
sys.maxsize < 2**32, |
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.
32 bit platforms have sys.maxsize == 2**31 - 1
, but I guess this also works :P
@pytest.mark.skipif(sys.maxsize < 2**32, reason="only problematic on 64bit platforms") | ||
@pytest.mark.skipif( | ||
sys.maxsize < 2**32, | ||
reason="only problematic on 64bit platforms" |
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.
also out of scope, but shouldn't this be "32bit platforms" 🤔
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.
I think the condition we want is to have np.iinfo(np.intc).max
smaller than sys.maxsize
. We can then create a list of size max_int + 1
, but this cannot be concatenated by numpy.
On my system (64-bit windows) the np.intc
is 32 bit, and sys.maxsize
is 2**63-1. The test fails though:
In [222]: a = np.array([1])
...: max_int = np.iinfo(np.intc).max
In [223]: arrs = (a,) * (max_int + 1)
...:
In [224]: np.concatenate(arrs)
...:
---------------------------------------------------------------------------
SystemError Traceback (most recent call last)
Cell In[224], line 1
----> 1 np.concatenate(arrs)
SystemError: <built-in function concatenate> returned NULL without setting an exception
Maybe because the amount of memory I have is not enough.
I'll happily leave this to another PR though!
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.
sys.maxsize
corresponds to np.iinfo(np.intp).max
and ctypes.sizeof(ctypes.c_ssize_t)
I believe
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.
I'll happily leave this to another PR though!
yea, probably for the best
Part of #28947