Skip to content

Commit 886d361

Browse files
guan404mingseberg
andauthored
DOC: update np.shares_memory() docs (numpy#27090)
Description In NumPy 2.0, the MAY_SHARE_EXACT and MAY_SHARE_BOUNDS constants are no longer exposed as part of the public API. This PR updates the documentation for np.shares_memory functions to reflect this change. Changes made Replaced MAY_SHARE_EXACT with its actual value -1 in the documentation. Replaced MAY_SHARE_BOUNDS with its actual value 0 in the documentation. Updated the warning message to remove references to MAY_SHARE_BOUNDS. These changes ensure that the documentation accurately reflects the current implementation and provides clear guidance for users on how to correctly use these functions in NumPy 2.0. Close numpy#27089 Co-authored-by: Sebastian Berg <[email protected]>
1 parent f433d61 commit 886d361

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

numpy/_core/multiarray.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1350,7 +1350,7 @@ def shares_memory(a, b, max_work=None):
13501350
.. warning::
13511351
13521352
This function can be exponentially slow for some inputs, unless
1353-
`max_work` is set to a finite number or ``MAY_SHARE_BOUNDS``.
1353+
`max_work` is set to zero or a positive integer.
13541354
If in doubt, use `numpy.may_share_memory` instead.
13551355
13561356
Parameters
@@ -1362,12 +1362,13 @@ def shares_memory(a, b, max_work=None):
13621362
of candidate solutions to consider). The following special
13631363
values are recognized:
13641364
1365-
max_work=MAY_SHARE_EXACT (default)
1365+
max_work=-1 (default)
13661366
The problem is solved exactly. In this case, the function returns
13671367
True only if there is an element shared between the arrays. Finding
13681368
the exact solution may take extremely long in some cases.
1369-
max_work=MAY_SHARE_BOUNDS
1369+
max_work=0
13701370
Only the memory bounds of a and b are checked.
1371+
This is equivalent to using ``may_share_memory()``.
13711372
13721373
Raises
13731374
------

0 commit comments

Comments
 (0)