Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

GPU tests expect ValueError from dataclasses.replace on init=False fields; Python 3.13 raises TypeError

Open Beginner friendly
#109 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
86/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
python

Research direction

Read the two pytest.raises(ValueError) assertions in tests/xpois/test_ois.py around line 478 and tests/xfit/test_models.py around line 921. Check how the tests exercise dataclasses.replace() with init=False fields, then run these GPU tests with CuPy on Python 3.12 and 3.13. Done when both tests accept the exception behavior on both versions and their other assertions still pass.

Written by the indexing model from the issue text.

Description

bug

Two GPU tests assert the exception type that dataclasses.replace() raised on Python 3.12 when a field declared with init=False is passed. Python 3.13 raises TypeError where 3.12 raised ValueError, so both tests fail on 3.13 with CuPy installed.

Observed on one GPU host with Python 3.13.7, CuPy 14.1.1 and CUDA 13 at main (ffb1d38):

tests/xpois/test_ois.py:479: in test_solve_constant_kernel_device_matches_cpu_and_stays_on_device
    replace(result, solver="spatial-als")
E   TypeError: field solver is declared with init=False, it cannot be specified with replace()

tests/xfit/test_models.py:929: in test_fit_dipoles_device_matches_portable_result_without_bulk_d2h
    replace(device, **{name: value})
E   TypeError: field schema is declared with init=False, it cannot be specified with replace()

Both sites are inside with pytest.raises(ValueError): (test_ois.py:478-479, test_models.py:921-929, the loop over schema, solver, backend, result_location). Every other assertion in the two tests passes, and the same two tests pass on Python 3.12.

CI does not see it: the Python 3.13 and 3.14 matrix entries run without CuPy, so these GPU tests skip there, and the GPU job runs Python 3.12.

Suggested fix: expect (TypeError, ValueError) at both sites, or assert on the message ("declared with init=False"), which is the same on both versions. The library behavior is unchanged; only the expected exception type in the tests depends on the interpreter.

Dominant language
Python
Stars
18
Forks
9
Avg merge
2d 2h
Merged PRs (30d)
90

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from NVIDIA/cuPhoton

All issues in NVIDIA/cuPhoton

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.