Skip to content

Conversation

jcfr
Copy link
Contributor

@jcfr jcfr commented Sep 25, 2025

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 fallback to the legacy globals on older versions.

No functional change intended.

@jcfr jcfr force-pushed the support-python312-config-flags branch 2 times, most recently from 97ad9d2 to 6ad2baa Compare September 25, 2025 21:59
@jcfr jcfr changed the title chore: use PyConfig.verbose/optimization_level on Python >= 3.12; fallback to legacy flags chore(importer): read sys.flags (verbose/optimize) on Py ≥ 3.12; fallback to legacy globals Sep 25, 2025
@jcfr jcfr changed the title chore(importer): read sys.flags (verbose/optimize) on Py ≥ 3.12; fallback to legacy globals chore(importer): read sys.flags (verbose/optimize) on Python ≥ 3.12; fallback to legacy globals Sep 25, 2025
@jcfr jcfr changed the title chore(importer): read sys.flags (verbose/optimize) on Python ≥ 3.12; fallback to legacy globals chore(importer): read sys.flags (verbose/optimize) on Python >= 3.12; fallback to legacy globals Sep 25, 2025
…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 <[email protected]>
@jcfr jcfr force-pushed the support-python312-config-flags branch from 6ad2baa to 3487676 Compare September 25, 2025 22:00
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 mrbean-bremen merged commit 95f99ff into MeVisLab:master Sep 26, 2025
17 checks passed
@jcfr jcfr deleted the support-python312-config-flags branch September 26, 2025 19:47
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.

4 participants