Skip to content

Commit

Permalink
ffi: add some PyPy cfgs
Browse files Browse the repository at this point in the history
  • Loading branch information
davidhewitt committed Aug 27, 2021
1 parent a8cc9c3 commit 86dacd4
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
13 changes: 13 additions & 0 deletions src/ffi/cpython/pythonrun.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -156,31 +157,42 @@ 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,
s: c_int,
g: *mut PyObject,
l: *mut PyObject,
) -> *mut PyObject;
#[cfg(not(PyPy))]
pub fn PyRun_FileEx(
fp: *mut FILE,
p: *const c_char,
Expand All @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions src/ffi/pythonrun.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 86dacd4

Please sign in to comment.