Skip to content

Fix pickling error that occurs with scipy>=1.18 - #28

Merged
c-randall merged 2 commits into
mainfrom
bugfix/scipy-pickle
Jul 9, 2026
Merged

Fix pickling error that occurs with scipy>=1.18#28
c-randall merged 2 commits into
mainfrom
bugfix/scipy-pickle

Conversation

@c-randall

Copy link
Copy Markdown
Collaborator

Description

As of scipy 1.18, some objects carry references to numpy and/or other modules. This creates an issue when creating deep copies or pickling. This update fixes this issue by ensuring the deepcopy method doesn't try to pickle modules. Instead, when objects are copied that store modules, the copy just returns the same reference to the stored module, since modules act as singletons.

Type of change

  • New feature (non-breaking change which adds functionality)
  • Optimization (back-end change that improves speed/readability/etc.)
  • Bug fix (non-breaking change which fixes an issue)
  • Chore (any other clean up, maintenance, etc.)

Key checklist:

  • No style issues: $ nox -s linter [-- format]
  • Code is free of misspellings: $ nox -s codespell [-- write]
  • All tests pass: $ nox -s tests

Further checks:

  • The documentation builds: $ nox -s docs.
  • Code is commented, particularly in hard-to-understand areas.
  • Tests are added that prove fix is effective or that feature works.

@codecov-commenter

codecov-commenter commented Jul 9, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.46%. Comparing base (4905761) to head (ee8547c).

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #28      +/-   ##
==========================================
+ Coverage   91.45%   91.46%   +0.01%     
==========================================
  Files          31       31              
  Lines        2234     2238       +4     
==========================================
+ Hits         2043     2047       +4     
  Misses        191      191              
Flag Coverage Δ
unittests 91.46% <100.00%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@c-randall
c-randall marked this pull request as ready for review July 9, 2026 16:15
@c-randall
c-randall merged commit 76279a9 into main Jul 9, 2026
11 checks passed
@c-randall
c-randall deleted the bugfix/scipy-pickle branch July 9, 2026 16:18
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.

2 participants