Skip to main content

pyo3_ffi/
sysmodule.rs

1use crate::object::PyObject;
2use core::ffi::{c_char, c_int};
3use libc::wchar_t;
4
5extern_libpython! {
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(not(Py_3_15))]
35    #[cfg_attr(
36        Py_3_13,
37        deprecated(
38            note = "Deprecated since Python 3.13. Clear sys.warnoptions and warnings.filters instead."
39        )
40    )]
41    pub fn PySys_ResetWarnOptions();
42    #[cfg_attr(Py_3_11, deprecated(note = "Python 3.11"))]
43    pub fn PySys_AddWarnOption(arg1: *const wchar_t);
44    #[cfg_attr(Py_3_11, deprecated(note = "Python 3.11"))]
45    pub fn PySys_AddWarnOptionUnicode(arg1: *mut PyObject);
46    #[cfg_attr(Py_3_11, deprecated(note = "Python 3.11"))]
47    pub fn PySys_HasWarnOptions() -> c_int;
48
49    pub fn PySys_AddXOption(arg1: *const wchar_t);
50    pub fn PySys_GetXOptions() -> *mut PyObject;
51}