10000 MAINT: Enable linting with ruff E501 by eendebakpt · Pull Request #29250 · numpy/numpy · GitHub
[go: up one dir, main page]

Skip to content

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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

eendebakpt
Copy link
Contributor

Part of #28947

Copy link
Member
@jorenham jorenham left a 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,
Copy link
Member

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"
Copy link
Member

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" 🤔

Copy link
Contributor Author

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!

Copy link
Member
@jorenham jorenham Jun 24, 2025

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

Copy link
Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0