pyo3_ffi/
sysmodule.rs

1use crate::object::PyObject;
2use libc::wchar_t;
3use std::os::raw::{c_char, c_int};
4
5extern "C" {
6    #[cfg_attr(PyPy, link_name = "PyPySys_GetObject")]
7    pub fn PySys_GetObject(arg1: *const c_char) -> *mut PyObject;
8    #[cfg_attr(PyPy, link_name = "PyPySys_SetObject")]
9    pub fn PySys_SetObject(arg1: *const c_char, arg2: *mut PyObject) -> c_int;
10
11    #[cfg_attr(
12        Py_3_11,
13        deprecated(
14            note = "Deprecated in Python 3.11, use `PyConfig.argv` and `PyConfig.parse_argv` instead"
15        )
16    )]
17    pub fn PySys_SetArgv(arg1: c_int, arg2: *mut *mut wchar_t);
18    #[cfg_attr(
19        Py_3_11,
20        deprecated(
21            note = "Deprecated in Python 3.11, use `PyConfig.argv` and `PyConfig.parse_argv` instead"
22        )
23    )]
24    pub fn PySys_SetArgvEx(arg1: c_int, arg2: *mut *mut wchar_t, arg3: c_int);
25    pub fn PySys_SetPath(arg1: *const wchar_t);
26
27    #[cfg_attr(PyPy, link_name = "PyPySys_WriteStdout")]
28    pub fn PySys_WriteStdout(format: *const c_char, ...);
29    #[cfg_attr(PyPy, link_name = "PyPySys_WriteStderr")]
30    pub fn PySys_WriteStderr(format: *const c_char, ...);
31    pub fn PySys_FormatStdout(format: *const c_char, ...);
32    pub fn PySys_FormatStderr(format: *const c_char, ...);
33
34    #[cfg_attr(
35        Py_3_13,
36        deprecated(
37            note = "Deprecated since Python 3.13. Clear sys.warnoptions and warnings.filters instead."
38        )
39    )]
40    pub fn PySys_ResetWarnOptions();
41    #[cfg_attr(Py_3_11, deprecated(note = "Python 3.11"))]
42    pub fn PySys_AddWarnOption(arg1: *const wchar_t);
43    #[cfg_attr(Py_3_11, deprecated(note = "Python 3.11"))]
44    pub fn PySys_AddWarnOptionUnicode(arg1: *mut PyObject);
45    #[cfg_attr(Py_3_11, deprecated(note = "Python 3.11"))]
46    pub fn PySys_HasWarnOptions() -> c_int;
47
48    pub fn PySys_AddXOption(arg1: *const wchar_t);
49    pub fn PySys_GetXOptions() -> *mut PyObject;
50}