1use crate::object::*;
2#[cfg(not(any(PyPy, Py_LIMITED_API, Py_3_10)))]
3use libc::FILE;
4#[cfg(any(Py_LIMITED_API, not(Py_3_10), PyPy, GraalPy))]
5use std::os::raw::c_char;
6use std::os::raw::c_int;
7
8extern "C" {
9 #[cfg(any(all(Py_LIMITED_API, not(PyPy)), GraalPy))]
10 pub fn Py_CompileString(string: *const c_char, p: *const c_char, s: c_int) -> *mut PyObject;
11
12 #[cfg_attr(PyPy, link_name = "PyPyErr_Print")]
13 pub fn PyErr_Print();
14 #[cfg_attr(PyPy, link_name = "PyPyErr_PrintEx")]
15 pub fn PyErr_PrintEx(arg1: c_int);
16 #[cfg_attr(PyPy, link_name = "PyPyErr_Display")]
17 pub fn PyErr_Display(arg1: *mut PyObject, arg2: *mut PyObject, arg3: *mut PyObject);
18
19 #[cfg(Py_3_12)]
20 pub fn PyErr_DisplayException(exc: *mut PyObject);
21}
22
23#[inline]
24#[cfg(PyPy)]
25pub unsafe fn Py_CompileString(string: *const c_char, p: *const c_char, s: c_int) -> *mut PyObject {
26 #[cfg(Py_LIMITED_API)]
30 extern "C" {
31 #[link_name = "PyPy_CompileStringFlags"]
32 pub fn Py_CompileStringFlags(
33 string: *const c_char,
34 p: *const c_char,
35 s: c_int,
36 f: *mut std::os::raw::c_void, ) -> *mut PyObject;
38 }
39 #[cfg(not(Py_LIMITED_API))]
40 use crate::Py_CompileStringFlags;
41
42 Py_CompileStringFlags(string, p, s, std::ptr::null_mut())
43}
44
45pub const PYOS_STACK_MARGIN: c_int = 2048;
48
49#[cfg(not(any(PyPy, Py_LIMITED_API, Py_3_10)))]
52opaque_struct!(_mod);
53
54#[cfg(not(any(PyPy, Py_3_10)))]
55opaque_struct!(symtable);
56#[cfg(not(any(PyPy, Py_3_10)))]
57opaque_struct!(_node);
58
59#[cfg(not(any(PyPy, Py_LIMITED_API, Py_3_10)))]
60#[cfg_attr(Py_3_9, deprecated(note = "Python 3.9"))]
61#[inline]
62pub unsafe fn PyParser_SimpleParseString(s: *const c_char, b: c_int) -> *mut _node {
63 #[allow(deprecated)]
64 crate::PyParser_SimpleParseStringFlags(s, b, 0)
65}
66
67#[cfg(not(any(PyPy, Py_LIMITED_API, Py_3_10)))]
68#[cfg_attr(Py_3_9, deprecated(note = "Python 3.9"))]
69#[inline]
70pub unsafe fn PyParser_SimpleParseFile(fp: *mut FILE, s: *const c_char, b: c_int) -> *mut _node {
71 #[allow(deprecated)]
72 crate::PyParser_SimpleParseFileFlags(fp, s, b, 0)
73}
74
75extern "C" {
76 #[cfg(not(any(PyPy, Py_3_10)))]
77 pub fn Py_SymtableString(
78 str: *const c_char,
79 filename: *const c_char,
80 start: c_int,
81 ) -> *mut symtable;
82 #[cfg(not(any(PyPy, Py_LIMITED_API, Py_3_10)))]
83 pub fn Py_SymtableStringObject(
84 str: *const c_char,
85 filename: *mut PyObject,
86 start: c_int,
87 ) -> *mut symtable;
88}