ffi: add some PyPy cfgs

This commit is contained in:
David Hewitt 2021-08-27 22:57:02 +01:00 committed by GitHub
parent a8cc9c37d5
commit 86dacd47c7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 2 deletions

View File

@ -105,6 +105,7 @@ extern "C" {
arg4: *mut PyObject,
arg5: *mut PyCompilerFlags,
) -> *mut PyObject;
#[cfg(not(PyPy))]
pub fn PyRun_FileExFlags(
fp: *mut FILE,
filename: *const c_char,
@ -156,24 +157,34 @@ pub unsafe fn Py_CompileStringFlags(
// skipped _Py_SourceAsString
extern "C" {
#[cfg_attr(PyPy, link_name = "PyPyRun_String")]
pub fn PyRun_String(
string: *const c_char,
s: c_int,
g: *mut PyObject,
l: *mut PyObject,
) -> *mut PyObject;
#[cfg(not(PyPy))]
pub fn PyRun_AnyFile(fp: *mut FILE, name: *const c_char) -> c_int;
#[cfg(not(PyPy))]
pub fn PyRun_AnyFileEx(fp: *mut FILE, name: *const c_char, closeit: c_int) -> c_int;
#[cfg(not(PyPy))]
pub fn PyRun_AnyFileFlags(
arg1: *mut FILE,
arg2: *const c_char,
arg3: *mut PyCompilerFlags,
) -> c_int;
#[cfg_attr(PyPy, link_name = "PyPyRun_SimpleString")]
pub fn PyRun_SimpleString(s: *const c_char) -> c_int;
#[cfg(not(PyPy))]
pub fn PyRun_SimpleFile(f: *mut FILE, p: *const c_char) -> c_int;
#[cfg(not(PyPy))]
pub fn PyRun_SimpleFileEx(f: *mut FILE, p: *const c_char, c: c_int) -> c_int;
#[cfg(not(PyPy))]
pub fn PyRun_InteractiveOne(f: *mut FILE, p: *const c_char) -> c_int;
#[cfg(not(PyPy))]
pub fn PyRun_InteractiveLoop(f: *mut FILE, p: *const c_char) -> c_int;
#[cfg_attr(PyPy, link_name = "PyPyRun_File")]
pub fn PyRun_File(
fp: *mut FILE,
p: *const c_char,
@ -181,6 +192,7 @@ extern "C" {
g: *mut PyObject,
l: *mut PyObject,
) -> *mut PyObject;
#[cfg(not(PyPy))]
pub fn PyRun_FileEx(
fp: *mut FILE,
p: *const c_char,
@ -189,6 +201,7 @@ extern "C" {
l: *mut PyObject,
c: c_int,
) -> *mut PyObject;
#[cfg(not(PyPy))]
pub fn PyRun_FileFlags(
fp: *mut FILE,
p: *const c_char,

View File

@ -59,13 +59,13 @@ pub unsafe fn PyParser_SimpleParseFile(fp: *mut FILE, s: *const c_char, b: c_int
}
extern "C" {
#[cfg(not(Py_3_10))]
#[cfg(not(any(PyPy, Py_3_10)))]
pub fn Py_SymtableString(
str: *const c_char,
filename: *const c_char,
start: c_int,
) -> *mut symtable;
#[cfg(all(not(Py_LIMITED_API), not(Py_3_10)))]
#[cfg(not(any(Py_LIMITED_API, Py_3_10, PyPy)))]
pub fn Py_SymtableStringObject(
str: *const c_char,
filename: *mut PyObject,