Skip to content

Avoid resource warnings - #553

Open
larsoner wants to merge 1 commit into
fatiando:mainfrom
larsoner:resource
Open

larsoner wants to merge 1 commit into
fatiando:mainfrom
larsoner:resource

Conversation

@larsoner

@larsoner larsoner commented Sep 9, 2026

Copy link
Copy Markdown

I was getting a bunch of ResourceWarnings in MNE-Python CIs:

ResourceWarning: unclosed <ssl.SSLSocket fd=14, family=2, type=1, proto=6, laddr=('30.0.158.241', 47702), raddr=('18.25.8.254', 443)>

Fix it by wrapping in context managers that close the resource.

The diff is really just a couple of lines plus an indentation change, so viewing with whitespace off might aid review.

This is really arguably an upstream bug with urllib3-future where a session can be closed too early, but by creating and using the session, pooch can avoid it.

Relevant issues/PRs:

None that I saw with a quick search

@leouieda

leouieda commented Sep 9, 2026

Copy link
Copy Markdown
Member

Thanks for reporting and for the fix! The test failure seems to be non-related (I'm rerunning to check) and the style failure as well. I'll take a closer look later and merge if nothing comes up.

This branch has not been deployed

No deployments
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