Skip to content

Fix scipy file-object dataset pickling#11347

Open
puneetdixit200 wants to merge 2 commits into
pydata:mainfrom
puneetdixit200:fix/11323-scipy-pickle
Open

Fix scipy file-object dataset pickling#11347
puneetdixit200 wants to merge 2 commits into
pydata:mainfrom
puneetdixit200:fix/11323-scipy-pickle

Conversation

@puneetdixit200
Copy link
Copy Markdown

Description

Closes #11323.

This keeps the scipy file-object netCDF workaround class stable across opens by defining it at module scope again. That avoids replacing the class object that pickle resolves for an already-open dataset when another scipy file object is opened.

The regression test opens two scipy file-object-backed datasets and pickles the first while the second remains open.

Checklist

AI Disclosure

  • This PR contains AI-generated content.
    • I have tested any AI-generated content in my PR.
    • I take responsibility for any AI-generated content in my PR.
      Tools: OpenAI GPT-5

@puneetdixit200 puneetdixit200 force-pushed the fix/11323-scipy-pickle branch from 199c7a7 to 087f464 Compare May 30, 2026 10:56
Copy link
Copy Markdown
Collaborator

@headtr1ck headtr1ck left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No idea why a function works but a class not. Pickling is weird...

Anyway, LGTM

@headtr1ck
Copy link
Copy Markdown
Collaborator

These workarounds are getting uglier and uglier with each iteration, haha. Now we even have globals. But I'm fine with this change. Maybe somebody else might want to take a look at this?

@headtr1ck headtr1ck added needs review regression and removed topic-hypothesis Strategies or tests using the hypothesis library labels Jun 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2026.4.0 breaks pickling with backends.scipy_

2 participants