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