pyo3_ffi/cpython/
pydebug.rs1use std::ffi::{c_char, c_int};
2
3#[cfg(not(Py_LIMITED_API))]
4extern_libpython! {
5 #[deprecated(note = "Python 3.12")]
6 #[cfg_attr(PyPy, link_name = "PyPy_DebugFlag")]
7 pub static mut Py_DebugFlag: c_int;
8 #[deprecated(note = "Python 3.12")]
9 #[cfg_attr(PyPy, link_name = "PyPy_VerboseFlag")]
10 pub static mut Py_VerboseFlag: c_int;
11 #[deprecated(note = "Python 3.12")]
12 pub static mut Py_QuietFlag: c_int;
13 #[deprecated(note = "Python 3.12")]
14 #[cfg_attr(PyPy, link_name = "PyPy_InteractiveFlag")]
15 pub static mut Py_InteractiveFlag: c_int;
16 #[deprecated(note = "Python 3.12")]
17 #[cfg_attr(PyPy, link_name = "PyPy_InspectFlag")]
18 pub static mut Py_InspectFlag: c_int;
19 #[deprecated(note = "Python 3.12")]
20 #[cfg_attr(PyPy, link_name = "PyPy_OptimizeFlag")]
21 pub static mut Py_OptimizeFlag: c_int;
22 #[deprecated(note = "Python 3.12")]
23 #[cfg_attr(PyPy, link_name = "PyPy_NoSiteFlag")]
24 pub static mut Py_NoSiteFlag: c_int;
25 #[deprecated(note = "Python 3.12")]
26 #[cfg_attr(PyPy, link_name = "PyPy_BytesWarningFlag")]
27 pub static mut Py_BytesWarningFlag: c_int;
28 #[deprecated(note = "Python 3.12")]
29 #[cfg_attr(PyPy, link_name = "PyPy_UseClassExceptionsFlag")]
30 pub static mut Py_UseClassExceptionsFlag: c_int;
31 #[deprecated(note = "Python 3.12")]
32 #[cfg_attr(PyPy, link_name = "PyPy_FrozenFlag")]
33 pub static mut Py_FrozenFlag: c_int;
34 #[deprecated(note = "Python 3.12")]
35 #[cfg_attr(PyPy, link_name = "PyPy_IgnoreEnvironmentFlag")]
36 pub static mut Py_IgnoreEnvironmentFlag: c_int;
37 #[deprecated(note = "Python 3.12")]
38 #[cfg_attr(PyPy, link_name = "PyPy_DontWriteBytecodeFlag")]
39 pub static mut Py_DontWriteBytecodeFlag: c_int;
40 #[deprecated(note = "Python 3.12")]
41 #[cfg_attr(PyPy, link_name = "PyPy_NoUserSiteDirectory")]
42 pub static mut Py_NoUserSiteDirectory: c_int;
43 #[deprecated(note = "Python 3.12")]
44 pub static mut Py_UnbufferedStdioFlag: c_int;
45 #[cfg_attr(PyPy, link_name = "PyPy_HashRandomizationFlag")]
46 pub static mut Py_HashRandomizationFlag: c_int;
47 #[deprecated(note = "Python 3.12")]
48 pub static mut Py_IsolatedFlag: c_int;
49 #[cfg(windows)]
50 #[deprecated(note = "Python 3.12")]
51 pub static mut Py_LegacyWindowsFSEncodingFlag: c_int;
52 #[cfg(windows)]
53 #[deprecated(note = "Python 3.12")]
54 pub static mut Py_LegacyWindowsStdioFlag: c_int;
55}
56
57extern_libpython! {
58 #[cfg(Py_3_11)]
59 pub fn Py_GETENV(name: *const c_char) -> *mut c_char;
60}
61
62#[cfg(not(Py_3_11))]
63#[inline(always)]
64pub unsafe fn Py_GETENV(name: *const c_char) -> *mut c_char {
65 #[allow(deprecated)]
66 if Py_IgnoreEnvironmentFlag != 0 {
67 std::ptr::null_mut()
68 } else {
69 libc::getenv(name)
70 }
71}