Document and make explicit copy=None support in dpnp.nan_to_num - #3083
Merged
Merged
Conversation
Align the `copy` keyword of `dpnp.nan_to_num` with NumPy by documenting
and explicitly handling `copy=None` ("copy only if needed"), which for
supported array inputs replaces values in-place. Clarify the docstring to
describe the actual precondition (a writable array), and add tests
covering `copy=None` for in-place replacement and the read-only error path.
antonwolfy
requested review from
ndgrigorian and
vlad-perevezentsev
as code owners
October 2, 2026 13:13
Parametrize `test_copy_in_place` over the device-adaptive float/complex dtype list and build the NumPy input with that dtype, so the comparison stays dtype-consistent on devices without fp64 support (where a float64 input is downcast to float32).
Contributor
|
View rendered docs @ https://intelpython.github.io/dpnp/pull/3083/index.html |
ndgrigorian
approved these changes
Oct 2, 2026
Contributor
|
Array API standard conformance tests for dpnp=0.21.0dev11=np2py314h8d9cdd5_13 ran successfully. |
Collaborator
github-actions Bot
added a commit
that referenced
this pull request
Oct 2, 2026
…3083) `dpnp.nan_to_num` previously accepted `copy=None` only incidentally — the value was coerced by truthiness — and it was neither documented nor covered by tests. This PR aligns the `copy` keyword with NumPy by documenting and explicitly handling `copy=None` ("copy only if needed"), which for the supported array inputs replaces values in-place. 062cf59
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
dpnp.nan_to_numpreviously acceptedcopy=Noneonly incidentally — the value was coerced by truthiness — and it was neither documented nor covered by tests. This PR aligns thecopykeyword with NumPy by documenting and explicitly handlingcopy=None("copy only if needed"), which for the supported array inputs replaces values in-place.