Skip to content

Document and make explicit copy=None support in dpnp.nan_to_num - #3083

Merged
antonwolfy merged 2 commits into
masterfrom
nan-to-num-copy-none
Oct 2, 2026
Merged

antonwolfy merged 2 commits into
masterfrom
nan-to-num-copy-none

Conversation

@antonwolfy

@antonwolfy antonwolfy commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

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.

  • Have you provided a meaningful PR description?
  • Have you added a test, reproducer or referred to an issue with a reproducer?
  • Have you tested your changes locally for CPU and GPU devices?
  • Have you made sure that new changes do not introduce compiler warnings?
  • Have you checked performance impact of proposed changes?
  • Have you added documentation for your changes, if necessary?
  • Have you added your changes to the changelog?

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 antonwolfy added this to the 0.21.0 release milestone Oct 2, 2026
@antonwolfy antonwolfy self-assigned this Oct 2, 2026
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).
@github-actions

github-actions Bot commented Oct 2, 2026

Copy link
Copy Markdown
Contributor

View rendered docs @ https://intelpython.github.io/dpnp/pull/3083/index.html

@github-actions

github-actions Bot commented Oct 2, 2026

Copy link
Copy Markdown
Contributor

Array API standard conformance tests for dpnp=0.21.0dev11=np2py314h8d9cdd5_13 ran successfully.
Passed: 1376
Failed: 0
Skipped: 6

@coveralls

Copy link
Copy Markdown
Collaborator

Coverage Status

coverage: 78.62%. remained the same — nan-to-num-copy-none into master

@antonwolfy
antonwolfy merged commit 062cf59 into master Oct 2, 2026
106 of 109 checks passed
@antonwolfy
antonwolfy deleted the nan-to-num-copy-none branch October 2, 2026 16:03
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants