chore(importer): read sys.flags (verbose/optimize) on Python >= 3.12; fallback to legacy globals#311
Merged
mrbean-bremen merged 2 commits intoMeVisLab:masterfrom Sep 26, 2025
Conversation
97ad9d2 to
6ad2baa
Compare
PyConfig.verbose/optimization_level on Python >= 3.12; fallback to legacy flagssys.flags (verbose/optimize) on Py ≥ 3.12; fallback to legacy globals
sys.flags (verbose/optimize) on Py ≥ 3.12; fallback to legacy globalssys.flags (verbose/optimize) on Python ≥ 3.12; fallback to legacy globals
sys.flags (verbose/optimize) on Python ≥ 3.12; fallback to legacy globalssys.flags (verbose/optimize) on Python >= 3.12; fallback to legacy globals
…2; fallback to legacy globals Python 3.12 deprecates direct use of global flags (`Py_VerboseFlag`, `Py_OptimizeFlag`). Query `sys.flags.verbose` / `sys.flags.optimize` at runtime (via a small helper) when building against 3.12+, and fall back to the legacy globals on older versions. No functional change intended. Co-authored-by: Jean-Christophe Fillion-Robin <jchris.fillionr@kitware.com>
6ad2baa to
3487676
Compare
Introduce getSysVerbose() and getSysOptimizationLevel() to read verbosity/optimization in a version-safe way: On Python ≥ 3.12: query sys.flags.verbose / sys.flags.optimize. On older Pythons: fall back to Py_VerboseFlag / Py_OptimizeFlag.
mrbean-bremen
approved these changes
Sep 26, 2025
usiems
approved these changes
Sep 26, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Python 3.12 deprecates direct use of global flags (
Py_VerboseFlag,Py_OptimizeFlag). Querysys.flags.verbose/sys.flags.optimizeat runtime (via a small helper) when building against 3.12+, and fallback to the legacy globals on older versions.No functional change intended.