-
-
Notifications
You must be signed in to change notification settings - Fork 10.9k
BUG: Choose (and probably more item selection) leaks references with out=
#22683
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
Labels
Comments
tylerjereddy
added a commit
to tylerjereddy/numpy
that referenced
this issue
Jul 15, 2023
* Fixes numpy#22683 * use `copyswap` to avoid the reference count leaking reported above when `np.choose` is used with `out` * my impression from the ticket is that Sebastian doesn't think `copyswap` is a perfect solution, but may suffice short-term?
tylerjereddy
added a commit
to tylerjereddy/numpy
that referenced
this issue
Jul 15, 2023
* Fixes numpy#22683 * use `copyswap` to avoid the reference count leaking reported above when `np.choose` is used with `out` * my impression from the ticket is that Sebastian doesn't think `copyswap` is a perfect solution, but may suffice short-term?
tylerjereddy
added a commit
to tylerjereddy/numpy
that referenced
this issue
Jul 18, 2023
* Fixes numpy#22683 * use `copyswap` to avoid the reference count leaking reported above when `np.choose` is used with `out` * my impression from the ticket is that Sebastian doesn't think `copyswap` is a perfect solution, but may suffice short-term?
seberg
pushed a commit
to tylerjereddy/numpy
that referenced
this issue
Jul 31, 2023
* Fixes numpy#22683 * use `copyswap` to avoid the reference count leaking reported above when `np.choose` is used with `out` * my impression from the ticket is that Sebastian doesn't think `copyswap` is a perfect solution, but may suffice short-term?
charris
pushed a commit
to charris/numpy
that referenced
this issue
Aug 3, 2023
* Fixes numpy#22683 * use `copyswap` to avoid the reference count leaking reported above when `np.choose` is used with `out` * my impression from the ticket is that Sebastian doesn't think `copyswap` is a perfect solution, but may suffice short-term?
charris
pushed a commit
to charris/numpy
that referenced
this issue
Nov 11, 2023
* Fixes numpy#22683 * use `copyswap` to avoid the reference count leaking reported above when `np.choose` is used with `out` * my impression from the ticket is that Sebastian doesn't think `copyswap` is a perfect solution, but may suffice short-term?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Describe the issue:
np.choose
internally uses raw access to the array data and a finalPyArray_INCREF
. That somewhat works generally, but ifout=
is specified, that result array would need to be cleared first.The short-term solution here is likely that we need to use the element copy function rather than memcpy when necessary (elsewhere, we currently use
copyswap
if the dtype flags "needs API").I suspect, we need to keep something like
copyswap
, but I need to also think about how to evolve that function.Reproduce the code example:
Error message:
No response
NumPy/Python version information:
NumPy 1.25 and earlier
Context for the issue:
No response
The text was updated successfully, but these errors were encountered: