MCPcopy Create free account
hub / github.com/PyO3/pyo3 / Py_CompileString

Function Py_CompileString

pyo3-ffi/src/pythonrun.rs:26–44  ·  view source on GitHub ↗
(string: *const c_char, p: *const c_char, s: c_int)

Source from the content-addressed store, hash-verified

24#[inline]
25#[cfg(PyPy)]
26pub unsafe fn Py_CompileString(string: *const c_char, p: *const c_char, s: c_int) -> *mut PyObject {
27 // PyPy's implementation of Py_CompileString always forwards to Py_CompileStringFlags; this
28 // is only available in the non-limited API and has a real definition for all versions in
29 // the cpython/ subdirectory.
30 #[cfg(Py_LIMITED_API)]
31 extern_libpython! {
32 #[link_name = "PyPy_CompileStringFlags"]
33 pub fn Py_CompileStringFlags(
34 string: *const c_char,
35 p: *const c_char,
36 s: c_int,
37 f: *mut core::ffi::c_void, // Actually *mut Py_CompilerFlags in the real definition
38 ) -> *mut PyObject;
39 }
40 #[cfg(not(Py_LIMITED_API))]
41 use crate::Py_CompileStringFlags;
42
43 Py_CompileStringFlags(string, p, s, core::ptr::null_mut())
44}
45
46// skipped PyOS_InputHook
47

Callers 3

run_codeFunction · 0.50
from_codeMethod · 0.50
compileMethod · 0.50

Calls 1

Py_CompileStringFlagsFunction · 0.85

Tested by 1

run_codeFunction · 0.40