[FULL 3.12 SUPPORT] Enhances Python compatibility to version 3.12 #1542
+65
−531
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request updates the project's Python compatibility and modernizes some internal code to improve reliability and future-proofing. The most important changes are grouped below:
Python Version Updates:
.github/workflows/test.ymlto use Python 3.12 as the latest version and removed the deprecated3.12-deventry from the matrix. Also addedworkflow_dispatchas a trigger for manual workflow runs.tox.inienvironment list, ensuring local and CI testing covers the latest Python release.Code Modernization and Reliability:
distutils.spawn.find_executablewithshutil.whichinthefuck/system/unix.pyfor checking executable presence, and updated theopen_commandfunction to usewhich. [1] [2]thefuck/conf.pyfor dynamic module loading: now raisesImportErrorif the spec or loader is missing, and registers the loaded module insys.modulesfor better compatibility. Also broadened the exception handling to catch all exceptions, falling back to the legacy loader only if necessary.