Skip to content

MNT Copy the CPython resource tracker code rather than derive from it#472

Open
lesteve wants to merge 6 commits intojoblib:masterfrom
lesteve:copy-python-stdlib-resource-tracker-rather-than-derive
Open

MNT Copy the CPython resource tracker code rather than derive from it#472
lesteve wants to merge 6 commits intojoblib:masterfrom
lesteve:copy-python-stdlib-resource-tracker-rather-than-derive

Conversation

@lesteve
Copy link
Member

@lesteve lesteve commented Sep 1, 2025

This may be preferable to avoid being affected by a CPython change in the future as in #459, especially since now we override the _ensure_running_and_write method.

I tried to mostly add the CPython 3.13.7 resource_tracker code from the non-overriden methods and left things out where I was able to quickly see it was not used e.g. self._reentrant_messages.

We could align the code even more in a further PR, e.g. single vs double quotes (easy mostly needs to tell black to ignore this file) or some other things (reentrant logic, some small logic change in main, etc ...).

@ogrisel
Copy link
Contributor

ogrisel commented Sep 2, 2025

There are teardown errors after tests/test_reusable_executor.py::TestExecutorDeadLock::test_crash_races[13] and subsequent tests on CPython 3.14.0rc2t.

Maybe we should directly sync with the code of the current main of CPython instead of CPython 3.13.7.

+1 for using the same code style as in CPython and configure the linter to ignore this file to ease future synchronizations.

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