Skip to content

Make do_increase a method of jitcdde - #69

Merged
Wrzlprmft merged 1 commit into
neurophysik:masterfrom
alexfikl:fix-temp-cleanup
Oct 29, 2026
Merged

Wrzlprmft merged 1 commit into
neurophysik:masterfrom
alexfikl:fix-temp-cleanup

Conversation

@alexfikl

Copy link
Copy Markdown
Contributor

This moves do_integration out of set_integration_parameters and makes it an actual method of the class.

The motivation for this was that calling set_integration_parameters was making the code issue warnings like this on teardown

/usr/lib/python3.14/tempfile.py:962: ResourceWarning: Implicitly cleaning up <TemporaryDirectory '/tmp/jitcxde_a5d6ob4l'>

This turned out to be because of do_increase creating a closure that captured self and then the self.do_increase = do_increase created a nice reference cycle. That made the cleanup of the temporary directory in __del__ not fire correctly (it did still fire, just not in the right order?). This breaks the reference cycle so that warning no longer shows up.

@Wrzlprmft

Wrzlprmft commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Looks good. I wonder why I ever did it that way. I blame premature optimisation.

@Wrzlprmft
Wrzlprmft merged commit 411b213 into neurophysik:master Oct 29, 2026
8 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.

2 participants