Skip to content

Fix closing contexts of tar and zip files and add test 3.14t in CI#2012

Merged
martindurant merged 2 commits intofsspec:masterfrom
ariostas:fix_file_closing
Apr 14, 2026
Merged

Fix closing contexts of tar and zip files and add test 3.14t in CI#2012
martindurant merged 2 commits intofsspec:masterfrom
ariostas:fix_file_closing

Conversation

@ariostas
Copy link
Copy Markdown
Contributor

I ran into an issue while testing Uproot with Python 3.14t in this PR scikit-hep/uproot5#1619. Since garbage collection on freethreaded mode is a bit looser, it doesn't end up immediately closing contexts when an object is dropped, and you end up with warnings like ResourceWarning: unclosed file .... To solve this, we can explicitly call __exit__ in __del__. I also added close() to the tar implementation, since it was missing.

@ikrommyd
Copy link
Copy Markdown

is there a particular reason fsspec is not being tested in 3.14t atm @martindurant ?

@martindurant
Copy link
Copy Markdown
Member

is there a particular reason fsspec is not being tested in 3.14t

Only that no one has added it - feel free to do so.

@ikrommyd
Copy link
Copy Markdown

Should it be added here and turn this into a 3.14t testing/compatibility PR?

@martindurant
Copy link
Copy Markdown
Member

Yes, let's try

@ariostas ariostas force-pushed the fix_file_closing branch 2 times, most recently from a5e7b40 to 9ab084c Compare April 13, 2026 21:01
@ariostas
Copy link
Copy Markdown
Contributor Author

I made some final tweaks and tested the CI in my fork and everything works: https://github.com/ariostas/filesystem_spec/actions/runs/24408370609/job/71297942303

@ariostas ariostas changed the title Fix closing contexts of tar and zip files Fix closing contexts of tar and zip files and add test 3.14t in CI Apr 14, 2026
@martindurant martindurant merged commit cb36bec into fsspec:master Apr 14, 2026
11 checks passed
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