Skip to main content

pyforge_ffi/
sysmodule.rs

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