Skip to main content

use_pyo3_cfgs

Function use_pyo3_cfgs 

Source
pub fn use_pyo3_cfgs()
Expand description

Adds all the #[cfg] flags to the current compilation.

This should be called from a build script.

The full list of attributes added are the following:

FlagDescription
#[cfg(Py_3_8)], #[cfg(Py_3_9)], #[cfg(Py_3_10)], #[cfg(Py_3_11)], …These attributes mark code only for a given Python version and up. For example, #[cfg(Py_3_8)] marks code which can run on Python 3.8 and newer. There is one attribute for each Python version currently supported by PyO3.
#[cfg(Py_LIMITED_API)]This marks code which is run when compiling with PyO3’s abi3 or abi3t feature enabled.
#[cfg(Py_GIL_DISABLED)]This marks code which is run on the free-threaded interpreter.
#[cfg(PyPy)]This marks code which is run when compiling for PyPy.
#[cfg(GraalPy)]This marks code which is run when compiling for GraalPy.

For examples of how to use these attributes, see PyO3’s guide .

⚠️ Internal Docs ⚠️ Not Public API 👉 Official Docs Here