8000 ENH: increase NPY_MAXARGS to 256 by juliantaylor · Pull Request #4840 · numpy/numpy · GitHub
[go: up one dir, main page]

Skip to content

ENH: increase NPY_MAXARGS to 256 #4840

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

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions doc/release/1.9.0-notes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,12 @@ MaskedArray support for more complicated base classes
Built-in assumptions that the baseclass behaved like a plain array are being
removed. In particalur, ``repr`` and ``str`` should now work more reliably.

Maximum nditer operands increased to 256
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The maximum 10000 number of operands that nditer can handle has been increased from
32 to 256. This allows applications like `numexpr` to work with larger
expressions.


C-API
~~~~~
Expand Down
2 changes: 1 addition & 1 deletion numpy/core/include/numpy/ndarraytypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
*/

#define NPY_MAXDIMS 32
#define NPY_MAXARGS 32
#define NPY_MAXARGS 256

/* Used for Converter Functions "O&" code in ParseTuple */
#define NPY_FAIL 0
Expand Down
2 changes: 1 addition & 1 deletion numpy/core/tests/test_nditer.py
Original file line number Diff line number Diff line change
Expand Up @@ -686,7 +686,7 @@ def test_iter_flags_errors():
# Not enough operands
assert_raises(ValueError, nditer, [], [], [])
# Too many operands
assert_raises(ValueError, nditer, [a]*100, [], [['readonly']]*100)
assert_raises(ValueError, nditer, [a]*500, [], [['readonly']]*500)
# Bad global flag
assert_raises(ValueError, nditer, [a], ['bad flag'], [['readonly']])
# Bad op flag
Expand Down
6 changes: 3 additions & 3 deletions numpy/lib/tests/test_function_base.py
5F78
Original file line number Diff line number Diff line change
Expand Up @@ -215,9 +215,9 @@ def test_non_bool_deprecation(self):
assert_raises(DeprecationWarning, select, conditions, choices)

def test_many_arguments(self):
# This used to be limited by NPY_MAXARGS == 32
conditions = [np.array([False])] * 100
choices = [np.array([1])] * 100
# This used to be limited by NPY_MAXARGS
conditions = [np.array([False])] * 500
choices = [np.array([1])] * 500
select(conditions, choices)


Expand Down
0