Skip to main content

pyforge_ffi/
pythonrun.rs

1use crate::object::*;
2#[cfg(not(any(Py_LIMITED_API, Py_3_10)))]
3use libc::FILE;
4#[cfg(not(Py_3_10))]
5use std::ffi::c_char;
6use std::ffi::c_int;
7
8extern_libpython! {
9    #[cfg(Py_LIMITED_API)]
10    pub fn Py_CompileString(string: *const c_char, p: *const c_char, s: c_int) -> *mut PyObject;
11
12    pub fn PyErr_Print();
13    pub fn PyErr_PrintEx(arg1: c_int);
14    pub fn PyErr_Display(arg1: *mut PyObject, arg2: *mut PyObject, arg3: *mut PyObject);
15
16    #[cfg(Py_3_12)]
17    pub fn PyErr_DisplayException(exc: *mut PyObject);
18}
19
20// skipped PyOS_InputHook
21
22pub const PYOS_STACK_MARGIN: c_int = 2048;
23
24// skipped PyOS_CheckStack under Microsoft C
25
26#[cfg(not(any(Py_LIMITED_API, Py_3_10)))]
27opaque_struct!(pub _mod);
28
29#[cfg(not(Py_3_10))]
30opaque_struct!(pub symtable);
31#[cfg(not(Py_3_10))]
32opaque_struct!(pub _node);
33
34#[cfg(not(any(Py_LIMITED_API, Py_3_10)))]
35#[cfg_attr(Py_3_9, deprecated(note = "Python 3.9"))]
36#[inline]
37pub unsafe fn PyParser_SimpleParseString(s: *const c_char, b: c_int) -> *mut _node {
38    #[allow(deprecated)]
39    crate::PyParser_SimpleParseStringFlags(s, b, 0)
40}
41
42#[cfg(not(any(Py_LIMITED_API, Py_3_10)))]
43#[cfg_attr(Py_3_9, deprecated(note = "Python 3.9"))]
44#[inline]
45pub unsafe fn PyParser_SimpleParseFile(fp: *mut FILE, s: *const c_char, b: c_int) -> *mut _node {
46    #[allow(deprecated)]
47    crate::PyParser_SimpleParseFileFlags(fp, s, b, 0)
48}
49
50extern_libpython! {
51    #[cfg(not(Py_3_10))]
52    pub fn Py_SymtableString(
53        str: *const c_char,
54        filename: *const c_char,
55        start: c_int,
56    ) -> *mut symtable;
57    #[cfg(not(any(Py_LIMITED_API, Py_3_10)))]
58    pub fn Py_SymtableStringObject(
59        str: *const c_char,
60        filename: *mut PyObject,
61        start: c_int,
62    ) -> *mut symtable;
63}