Move files from ffi3 into ffi

Since Python 2 is no longer supported, one folder should be enough.
This commit is contained in:
Alexander Niederbühl 2019-09-07 00:29:50 +02:00
parent 73947d84b4
commit 68c3208d35
57 changed files with 282 additions and 289 deletions

View file

@ -1,4 +1,4 @@
use crate::ffi3::object::PyTypeObject;
use crate::ffi::object::PyTypeObject;
#[cfg_attr(windows, link(name = "pythonXY"))]
extern "C" {

View file

@ -1,5 +1,5 @@
use crate::ffi3::longobject::PyLongObject;
use crate::ffi3::object::*;
use crate::ffi::longobject::PyLongObject;
use crate::ffi::object::*;
use std::os::raw::{c_int, c_long};
#[cfg_attr(windows, link(name = "pythonXY"))]

View file

@ -1,5 +1,5 @@
use crate::ffi3::object::*;
use crate::ffi3::pyport::Py_ssize_t;
use crate::ffi::object::*;
use crate::ffi::pyport::Py_ssize_t;
use std::os::raw::{c_char, c_int};
#[cfg_attr(windows, link(name = "pythonXY"))]

View file

@ -1,5 +1,5 @@
use crate::ffi3::object::*;
use crate::ffi3::pyport::Py_ssize_t;
use crate::ffi::object::*;
use crate::ffi::pyport::Py_ssize_t;
use std::os::raw::{c_char, c_int};
#[cfg_attr(windows, link(name = "pythonXY"))]

View file

@ -1,7 +1,7 @@
#[cfg(Py_3_6)]
use crate::ffi3::code::FreeFunc;
use crate::ffi3::object::PyObject;
use crate::ffi3::pystate::PyThreadState;
use crate::ffi::code::FreeFunc;
use crate::ffi::object::PyObject;
use crate::ffi::pystate::PyThreadState;
use std::os::raw::{c_char, c_int, c_void};
#[cfg_attr(windows, link(name = "pythonXY"))]
@ -36,7 +36,7 @@ extern "C" {
pub fn PyEval_GetGlobals() -> *mut PyObject;
#[cfg_attr(PyPy, link_name = "PyPyEval_GetLocals")]
pub fn PyEval_GetLocals() -> *mut PyObject;
pub fn PyEval_GetFrame() -> *mut crate::ffi3::PyFrameObject;
pub fn PyEval_GetFrame() -> *mut crate::ffi::PyFrameObject;
#[cfg_attr(PyPy, link_name = "PyPy_AddPendingCall")]
pub fn Py_AddPendingCall(
func: Option<extern "C" fn(arg1: *mut c_void) -> c_int>,
@ -55,22 +55,22 @@ extern "C" {
// TODO: Py_EnterRecursiveCall etc.
#[cfg(Py_3_6)]
pub type _PyFrameEvalFunction =
extern "C" fn(*mut crate::ffi3::PyFrameObject, c_int) -> *mut PyObject;
extern "C" fn(*mut crate::ffi::PyFrameObject, c_int) -> *mut PyObject;
#[cfg_attr(windows, link(name = "pythonXY"))]
extern "C" {
pub fn PyEval_GetFuncName(arg1: *mut PyObject) -> *const c_char;
pub fn PyEval_GetFuncDesc(arg1: *mut PyObject) -> *const c_char;
pub fn PyEval_GetCallStats(arg1: *mut PyObject) -> *mut PyObject;
pub fn PyEval_EvalFrame(arg1: *mut crate::ffi3::PyFrameObject) -> *mut PyObject;
pub fn PyEval_EvalFrame(arg1: *mut crate::ffi::PyFrameObject) -> *mut PyObject;
#[cfg(Py_3_6)]
pub fn _PyEval_EvalFrameDefault(
arg1: *mut crate::ffi3::PyFrameObject,
arg1: *mut crate::ffi::PyFrameObject,
exc: c_int,
) -> *mut PyObject;
#[cfg(Py_3_6)]
pub fn _PyEval_RequestCodeExtraIndex(func: FreeFunc) -> c_int;
pub fn PyEval_EvalFrameEx(f: *mut crate::ffi3::PyFrameObject, exc: c_int) -> *mut PyObject;
pub fn PyEval_EvalFrameEx(f: *mut crate::ffi::PyFrameObject, exc: c_int) -> *mut PyObject;
#[cfg_attr(PyPy, link_name = "PyPyEval_SaveThread")]
pub fn PyEval_SaveThread() -> *mut PyThreadState;
#[cfg_attr(PyPy, link_name = "PyPyEval_RestoreThread")]

View file

@ -1,5 +1,5 @@
use crate::ffi3::object::*;
use crate::ffi3::pyport::Py_ssize_t;
use crate::ffi::object::*;
use crate::ffi::pyport::Py_ssize_t;
use std::os::raw::{c_char, c_int, c_uchar, c_void};
#[repr(C)]
@ -124,5 +124,5 @@ pub unsafe fn PyCode_Check(op: *mut PyObject) -> c_int {
#[inline]
#[cfg_attr(PyPy, link_name = "PyPyCode_GetNumFree")]
pub unsafe fn PyCode_GetNumFree(op: *mut PyCodeObject) -> Py_ssize_t {
crate::ffi3::tupleobject::PyTuple_GET_SIZE((*op).co_freevars)
crate::ffi::tupleobject::PyTuple_GET_SIZE((*op).co_freevars)
}

View file

@ -1,4 +1,4 @@
use crate::ffi3::object::PyObject;
use crate::ffi::object::PyObject;
use std::os::raw::{c_char, c_int};
#[cfg_attr(windows, link(name = "pythonXY"))]

View file

@ -1,7 +1,7 @@
use crate::ffi3::code::*;
use crate::ffi3::object::PyObject;
use crate::ffi3::pyarena::*;
use crate::ffi3::pythonrun::*;
use crate::ffi::code::*;
use crate::ffi::object::PyObject;
use crate::ffi::pyarena::*;
use crate::ffi::pythonrun::*;
use std::os::raw::{c_char, c_int};
#[repr(C)]

View file

@ -1,4 +1,4 @@
use crate::ffi3::object::*;
use crate::ffi::object::*;
use std::os::raw::{c_double, c_int};
#[cfg_attr(windows, link(name = "pythonXY"))]

View file

@ -1,8 +1,8 @@
use crate::ffi3::methodobject::PyMethodDef;
use crate::ffi3::object::{PyObject, PyTypeObject};
use crate::ffi::methodobject::PyMethodDef;
use crate::ffi::object::{PyObject, PyTypeObject};
#[cfg(not(PyPy))]
use crate::ffi3::object::{PyObject_GenericGetDict, PyObject_GenericSetDict};
use crate::ffi3::structmember::PyMemberDef;
use crate::ffi::object::{PyObject_GenericGetDict, PyObject_GenericSetDict};
use crate::ffi::structmember::PyMemberDef;
use std::os::raw::{c_char, c_int, c_void};
use std::ptr;

View file

@ -1,5 +1,5 @@
use crate::ffi3::object::*;
use crate::ffi3::pyport::Py_ssize_t;
use crate::ffi::object::*;
use crate::ffi::pyport::Py_ssize_t;
use std::os::raw::{c_char, c_int};
#[cfg_attr(windows, link(name = "pythonXY"))]

View file

@ -1,4 +1,4 @@
use crate::ffi3::object::PyTypeObject;
use crate::ffi::object::PyTypeObject;
#[cfg_attr(windows, link(name = "pythonXY"))]
extern "C" {

View file

@ -1,4 +1,4 @@
use crate::ffi3::object::PyObject;
use crate::ffi::object::PyObject;
use std::os::raw::c_int;
#[cfg_attr(windows, link(name = "pythonXY"))]

View file

@ -1,4 +1,4 @@
use crate::ffi3::object::PyObject;
use crate::ffi::object::PyObject;
use std::os::raw::{c_char, c_int};
pub const PY_STDIOTEXTMODE: &str = "b";

View file

@ -1,4 +1,4 @@
use crate::ffi3::object::*;
use crate::ffi::object::*;
use std::os::raw::{c_double, c_int};
#[cfg(not(Py_LIMITED_API))]

View file

@ -1,6 +1,6 @@
use crate::ffi3::code::{PyCodeObject, CO_MAXBLOCKS};
use crate::ffi3::object::*;
use crate::ffi3::pystate::PyThreadState;
use crate::ffi::code::{PyCodeObject, CO_MAXBLOCKS};
use crate::ffi::object::*;
use crate::ffi::pystate::PyThreadState;
use std::os::raw::{c_char, c_int};
#[repr(C)]

View file

@ -1,6 +1,6 @@
use crate::ffi3::frameobject::PyFrameObject;
use crate::ffi3::object::*;
use crate::ffi3::pyport::Py_ssize_t;
use crate::ffi::frameobject::PyFrameObject;
use crate::ffi::object::*;
use crate::ffi::pyport::Py_ssize_t;
use std::os::raw::c_int;
#[repr(C)]

View file

@ -1,4 +1,4 @@
use crate::ffi3::object::PyObject;
use crate::ffi::object::PyObject;
use std::os::raw::{c_char, c_int, c_long};
#[cfg_attr(windows, link(name = "pythonXY"))]

View file

@ -1,4 +1,4 @@
use crate::ffi3::object::*;
use crate::ffi::object::*;
use std::os::raw::c_int;
#[cfg_attr(windows, link(name = "pythonXY"))]

View file

@ -1,5 +1,5 @@
use crate::ffi3::object::*;
use crate::ffi3::pyport::Py_ssize_t;
use crate::ffi::object::*;
use crate::ffi::pyport::Py_ssize_t;
use std::os::raw::c_int;
#[repr(C)]

View file

@ -1,5 +1,5 @@
use crate::ffi3::object::*;
use crate::ffi3::pyport::Py_ssize_t;
use crate::ffi::object::*;
use crate::ffi::pyport::Py_ssize_t;
use libc::size_t;
use std::os::raw::{
c_char, c_double, c_int, c_long, c_longlong, c_uchar, c_ulong, c_ulonglong, c_void,

View file

@ -1,5 +1,5 @@
use crate::ffi3::object::*;
use crate::ffi3::pyport::Py_ssize_t;
use crate::ffi::object::*;
use crate::ffi::pyport::Py_ssize_t;
use std::os::raw::{c_char, c_int};
#[cfg_attr(windows, link(name = "pythonXY"))]

View file

@ -1,4 +1,4 @@
use crate::ffi3::object::{PyObject, PyTypeObject, Py_TYPE};
use crate::ffi::object::{PyObject, PyTypeObject, Py_TYPE};
use std::os::raw::{c_char, c_int};
use std::{mem, ptr};
@ -19,7 +19,7 @@ pub type PyCFunction =
pub type _PyCFunctionFast = unsafe extern "C" fn(
slf: *mut PyObject,
args: *mut *mut PyObject,
nargs: crate::ffi3::pyport::Py_ssize_t,
nargs: crate::ffi::pyport::Py_ssize_t,
kwnames: *mut PyObject,
) -> *mut PyObject;

View file

@ -1,9 +1,157 @@
#![allow(non_camel_case_types, non_upper_case_globals, non_snake_case)]
pub use crate::ffi3::*;
#![allow(non_camel_case_types, non_snake_case, non_upper_case_globals)]
#![cfg_attr(Py_LIMITED_API, allow(unused_imports))]
#![cfg_attr(feature="cargo-clippy", allow(clippy::inline_always))]
pub use self::bltinmodule::*;
pub use self::boolobject::*;
pub use self::bytearrayobject::*;
pub use self::bytesobject::*;
pub use self::ceval::*;
pub use self::code::*;
pub use self::codecs::*;
pub use self::compile::*;
pub use self::complexobject::*;
pub use self::datetime::*;
pub use self::descrobject::*;
pub use self::dictobject::*;
pub use self::enumobject::*;
pub use self::eval::*;
pub use self::fileobject::*;
pub use self::floatobject::*;
pub use self::frameobject::PyFrameObject;
pub use self::genobject::*;
pub use self::import::*;
pub use self::intrcheck::*;
pub use self::iterobject::*;
pub use self::listobject::*;
pub use self::longobject::*;
pub use self::marshal::*;
pub use self::memoryobject::*;
pub use self::methodobject::*;
pub use self::modsupport::*;
pub use self::moduleobject::*;
pub use self::object::*;
pub use self::objectabstract::*;
pub use self::objimpl::*;
#[cfg(Py_3_6)]
pub use self::osmodule::*;
pub use self::pyarena::*;
pub use self::pycapsule::*;
pub use self::pydebug::*;
pub use self::pyerrors::*;
pub use self::pyhash::*;
pub use self::pymem::*;
pub use self::pyport::*;
pub use self::pystate::*;
pub use self::pystrtod::*;
pub use self::pythonrun::*;
pub use self::rangeobject::*;
pub use self::setobject::*;
pub use self::sliceobject::*;
pub use self::structseq::*;
pub use self::sysmodule::*;
pub use self::traceback::*;
pub use self::tupleobject::*;
pub use self::typeslots::*;
pub use self::unicodeobject::*;
pub use self::warnings::*;
pub use self::weakrefobject::*;
mod pyport;
// mod pymacro; contains nothing of interest for Rust
// mod pyatomic; contains nothing of interest for Rust
// mod pymath; contains nothing of interest for Rust
// [cfg(not(Py_LIMITED_API))]
// mod pytime; contains nothing of interest
mod pymem;
mod object;
mod objimpl;
mod pydebug;
mod pyhash;
mod typeslots;
mod bytearrayobject;
mod bytesobject;
mod longobject;
mod unicodeobject; // TODO supports PEP-384 only; needs adjustment for Python 3.3 and 3.5
// mod longintrepr; TODO excluded by PEP-384
mod boolobject; // TODO supports PEP-384 only; needs adjustment for Python 3.3 and 3.5
mod complexobject; // TODO supports PEP-384 only; needs adjustment for Python 3.3 and 3.5
mod dictobject;
mod floatobject; // TODO supports PEP-384 only; needs adjustment for Python 3.3 and 3.5
mod listobject; // TODO supports PEP-384 only; needs adjustment for Python 3.3 and 3.5
mod memoryobject; // TODO supports PEP-384 only; needs adjustment for Python 3.3 and 3.5
mod rangeobject; // TODO supports PEP-384 only; needs adjustment for Python 3.3 and 3.5
mod tupleobject; // TODO supports PEP-384 only; needs adjustment for Python 3.3 and 3.5
// mod odictobject; TODO new in 3.5
mod enumobject; // TODO supports PEP-384 only; needs adjustment for Python 3.3 and 3.5
mod methodobject; // TODO supports PEP-384 only; needs adjustment for Python 3.3 and 3.5
mod moduleobject;
mod setobject; // TODO supports PEP-384 only; needs adjustment for Python 3.3 and 3.5
// mod funcobject; TODO excluded by PEP-384
// mod classobject; TODO excluded by PEP-384
mod fileobject; // TODO supports PEP-384 only; needs adjustment for Python 3.3 and 3.5
mod pycapsule; // TODO supports PEP-384 only; needs adjustment for Python 3.3 and 3.5
mod sliceobject;
mod traceback; // TODO supports PEP-384 only; needs adjustment for Python 3.3 and 3.5
// mod cellobject; TODO excluded by PEP-384
mod descrobject; // TODO supports PEP-384 only; needs adjustment for Python 3.3 and 3.5
mod genobject; // TODO excluded by PEP-384
mod iterobject; // TODO supports PEP-384 only; needs adjustment for Python 3.3 and 3.5
mod structseq;
mod warnings; // TODO supports PEP-384 only; needs adjustment for Python 3.3 and 3.5
mod weakrefobject; // TODO supports PEP-384 only; needs adjustment for Python 3.3 and 3.5
// mod namespaceobject; TODO
mod codecs; // TODO supports PEP-384 only; needs adjustment for Python 3.3 and 3.5
mod pyerrors; // TODO supports PEP-384 only; needs adjustment for Python 3.3 and 3.5
mod pystate; // TODO supports PEP-384 only; needs adjustment for Python 3.3 and 3.5
#[cfg(Py_LIMITED_API)]
mod pyarena {}
mod modsupport; // TODO supports PEP-384 only; needs adjustment for Python 3.3 and 3.5
#[cfg(not(Py_LIMITED_API))]
mod pyarena; // TODO: incomplete
mod pythonrun; // TODO some functions need to be moved to pylifecycle
//mod pylifecycle; // TODO new in 3.5
mod ceval; // TODO supports PEP-384 only; needs adjustment for Python 3.3 and 3.5
mod import;
mod intrcheck; // TODO supports PEP-384 only; needs adjustment for Python 3.3 and 3.5
#[cfg(Py_3_6)]
mod osmodule;
mod sysmodule; // TODO supports PEP-384 only; needs adjustment for Python 3.3 and 3.5
mod bltinmodule;
mod objectabstract; // TODO supports PEP-384 only; needs adjustment for Python 3.3 and 3.5
#[cfg(Py_LIMITED_API)]
mod code {}
#[cfg(not(Py_LIMITED_API))]
mod code;
mod compile; // TODO: incomplete
mod eval; // TODO supports PEP-384 only; needs adjustment for Python 3.3 and 3.5
// mod pyctype; TODO excluded by PEP-384
mod pystrtod; // TODO supports PEP-384 only; needs adjustment for Python 3.3 and 3.5
// mod pystrcmp; TODO nothing interesting for Rust?
// mod dtoa; TODO excluded by PEP-384
// mod fileutils; TODO no public functions?
// mod pyfpe; TODO probably not interesting for rust
// Additional headers that are not exported by Python.h
pub mod structmember; // TODO supports PEP-384 only; needs adjustment for Python 3.3 and 3.5
#[cfg(not(Py_LIMITED_API))]
pub mod frameobject;
#[cfg(Py_LIMITED_API)]
pub mod frameobject {
pub enum PyFrameObject {}
}
pub(crate) mod datetime;
pub(crate) mod marshal;

View file

@ -1,7 +1,7 @@
use crate::ffi3::methodobject::PyMethodDef;
use crate::ffi3::moduleobject::PyModuleDef;
use crate::ffi3::object::PyObject;
use crate::ffi3::pyport::Py_ssize_t;
use crate::ffi::methodobject::PyMethodDef;
use crate::ffi::moduleobject::PyModuleDef;
use crate::ffi::object::PyObject;
use crate::ffi::pyport::Py_ssize_t;
use std::os::raw::{c_char, c_int, c_long};
#[cfg_attr(windows, link(name = "pythonXY"))]

View file

@ -1,6 +1,6 @@
use crate::ffi3::methodobject::PyMethodDef;
use crate::ffi3::object::*;
use crate::ffi3::pyport::Py_ssize_t;
use crate::ffi::methodobject::PyMethodDef;
use crate::ffi::object::*;
use crate::ffi::pyport::Py_ssize_t;
use std::os::raw::{c_char, c_int, c_void};
#[cfg_attr(windows, link(name = "pythonXY"))]

View file

@ -1,4 +1,4 @@
use crate::ffi3::pyport::{Py_hash_t, Py_ssize_t};
use crate::ffi::pyport::{Py_hash_t, Py_ssize_t};
#[cfg(PyPy)]
use std::ffi::CStr;
use std::mem;
@ -77,8 +77,8 @@ pub unsafe fn Py_REFCNT(ob: *mut PyObject) -> Py_ssize_t {
#[cfg(PyPy)]
pub unsafe fn _PyObject_NextNotImplemented(arg1: *mut PyObject) -> *mut PyObject {
return crate::ffi3::pyerrors::PyErr_Format(
crate::ffi3::pyerrors::PyExc_TypeError,
return crate::ffi::pyerrors::PyErr_Format(
crate::ffi::pyerrors::PyExc_TypeError,
CStr::from_bytes_with_nul(b"'%.200s' object is not iterable\0")
.unwrap()
.as_ptr(),
@ -132,7 +132,7 @@ pub type objobjargproc =
#[cfg(not(Py_LIMITED_API))]
mod bufferinfo {
use crate::ffi3::pyport::Py_ssize_t;
use crate::ffi::pyport::Py_ssize_t;
use std::mem;
use std::os::raw::{c_char, c_int, c_void};
@ -140,7 +140,7 @@ mod bufferinfo {
#[derive(Copy, Clone)]
pub struct Py_buffer {
pub buf: *mut c_void,
pub obj: *mut crate::ffi3::PyObject,
pub obj: *mut crate::ffi::PyObject,
pub len: Py_ssize_t,
pub itemsize: Py_ssize_t,
pub readonly: c_int,
@ -160,12 +160,12 @@ mod bufferinfo {
}
pub type getbufferproc = unsafe extern "C" fn(
arg1: *mut crate::ffi3::PyObject,
arg1: *mut crate::ffi::PyObject,
arg2: *mut Py_buffer,
arg3: c_int,
) -> c_int;
pub type releasebufferproc =
unsafe extern "C" fn(arg1: *mut crate::ffi3::PyObject, arg2: *mut Py_buffer) -> ();
unsafe extern "C" fn(arg1: *mut crate::ffi::PyObject, arg2: *mut Py_buffer) -> ();
/// Maximum number of dimensions
pub const PyBUF_MAX_NDIM: c_int = 64;
@ -249,8 +249,8 @@ mod typeobject {
#[cfg(not(Py_LIMITED_API))]
mod typeobject {
use crate::ffi3::pyport::Py_ssize_t;
use crate::ffi3::{self, object};
use crate::ffi::pyport::Py_ssize_t;
use crate::ffi::{self, object};
use std::mem;
use std::os::raw::{c_char, c_uint, c_ulong, c_void};
use std::ptr;
@ -485,27 +485,27 @@ mod typeobject {
pub tp_weaklistoffset: Py_ssize_t,
pub tp_iter: Option<object::getiterfunc>,
pub tp_iternext: Option<object::iternextfunc>,
pub tp_methods: *mut ffi3::methodobject::PyMethodDef,
pub tp_members: *mut ffi3::structmember::PyMemberDef,
pub tp_getset: *mut ffi3::descrobject::PyGetSetDef,
pub tp_methods: *mut ffi::methodobject::PyMethodDef,
pub tp_members: *mut ffi::structmember::PyMemberDef,
pub tp_getset: *mut ffi::descrobject::PyGetSetDef,
pub tp_base: *mut PyTypeObject,
pub tp_dict: *mut ffi3::object::PyObject,
pub tp_descr_get: Option<ffi3::object::descrgetfunc>,
pub tp_descr_set: Option<ffi3::object::descrsetfunc>,
pub tp_dict: *mut ffi::object::PyObject,
pub tp_descr_get: Option<ffi::object::descrgetfunc>,
pub tp_descr_set: Option<ffi::object::descrsetfunc>,
pub tp_dictoffset: Py_ssize_t,
pub tp_init: Option<ffi3::object::initproc>,
pub tp_alloc: Option<ffi3::object::allocfunc>,
pub tp_new: Option<ffi3::object::newfunc>,
pub tp_free: Option<ffi3::object::freefunc>,
pub tp_is_gc: Option<ffi3::object::inquiry>,
pub tp_bases: *mut ffi3::object::PyObject,
pub tp_mro: *mut ffi3::object::PyObject,
pub tp_cache: *mut ffi3::object::PyObject,
pub tp_subclasses: *mut ffi3::object::PyObject,
pub tp_weaklist: *mut ffi3::object::PyObject,
pub tp_del: Option<ffi3::object::destructor>,
pub tp_init: Option<ffi::object::initproc>,
pub tp_alloc: Option<ffi::object::allocfunc>,
pub tp_new: Option<ffi::object::newfunc>,
pub tp_free: Option<ffi::object::freefunc>,
pub tp_is_gc: Option<ffi::object::inquiry>,
pub tp_bases: *mut ffi::object::PyObject,
pub tp_mro: *mut ffi::object::PyObject,
pub tp_cache: *mut ffi::object::PyObject,
pub tp_subclasses: *mut ffi::object::PyObject,
pub tp_weaklist: *mut ffi::object::PyObject,
pub tp_del: Option<ffi::object::destructor>,
pub tp_version_tag: c_uint,
pub tp_finalize: Option<ffi3::object::destructor>,
pub tp_finalize: Option<ffi::object::destructor>,
#[cfg(PyPy)]
pub tp_pypy_flags: ::std::os::raw::c_long,
#[cfg(py_sys_config = "COUNT_ALLOCS")]
@ -543,7 +543,7 @@ mod typeobject {
tp_getattro: None,
tp_setattro: None,
tp_as_buffer: ptr::null_mut(),
tp_flags: ffi3::object::Py_TPFLAGS_DEFAULT,
tp_flags: ffi::object::Py_TPFLAGS_DEFAULT,
tp_doc: ptr::null(),
tp_traverse: None,
tp_clear: None,
@ -597,8 +597,8 @@ mod typeobject {
macro_rules! py_type_object_init {
($tp_as_async:ident, $($tail:tt)*) => {
_type_object_init!({
ob_base: ffi3::object::PyVarObject {
ob_base: ffi3::object::PyObject_HEAD_INIT,
ob_base: ffi::object::PyVarObject {
ob_base: ffi::object::PyObject_HEAD_INIT,
ob_size: 0
},}
$tp_as_async,
@ -640,9 +640,9 @@ mod typeobject {
pub as_mapping: PyMappingMethods,
pub as_sequence: PySequenceMethods,
pub as_buffer: PyBufferProcs,
pub ht_name: *mut ffi3::object::PyObject,
pub ht_slots: *mut ffi3::object::PyObject,
pub ht_qualname: *mut ffi3::object::PyObject,
pub ht_name: *mut ffi::object::PyObject,
pub ht_slots: *mut ffi::object::PyObject,
pub ht_qualname: *mut ffi::object::PyObject,
pub ht_cached_keys: *mut c_void,
}
@ -656,10 +656,10 @@ mod typeobject {
#[inline]
pub unsafe fn PyHeapType_GET_MEMBERS(
etype: *mut PyHeapTypeObject,
) -> *mut ffi3::structmember::PyMemberDef {
let py_type = ffi3::object::Py_TYPE(etype as *mut ffi3::object::PyObject);
) -> *mut ffi::structmember::PyMemberDef {
let py_type = ffi::object::Py_TYPE(etype as *mut ffi::object::PyObject);
let ptr = etype.offset((*py_type).tp_basicsize);
ptr as *mut ffi3::structmember::PyMemberDef
ptr as *mut ffi::structmember::PyMemberDef
}
}

View file

@ -1,5 +1,5 @@
use crate::ffi3::object::*;
use crate::ffi3::pyport::Py_ssize_t;
use crate::ffi::object::*;
use crate::ffi::pyport::Py_ssize_t;
use std::os::raw::{c_char, c_int, c_void};
use std::ptr;
@ -161,7 +161,7 @@ pub unsafe fn PyIter_Check(o: *mut PyObject) -> c_int {
(match (*(*o).ob_type).tp_iternext {
Some(tp_iternext) => {
tp_iternext as *const c_void
!= crate::ffi3::object::_PyObject_NextNotImplemented as *const c_void
!= crate::ffi::object::_PyObject_NextNotImplemented as *const c_void
}
None => false,
}) as c_int

View file

@ -1,5 +1,5 @@
use crate::ffi3::object::*;
use crate::ffi3::pyport::Py_ssize_t;
use crate::ffi::object::*;
use crate::ffi::pyport::Py_ssize_t;
use libc::size_t;
use std::os::raw::{c_int, c_void};

View file

@ -1,5 +1,5 @@
// This header is new in Python 3.6
use crate::ffi3::object::PyObject;
use crate::ffi::object::PyObject;
#[cfg_attr(windows, link(name = "pythonXY"))]
extern "C" {

View file

@ -1,4 +1,4 @@
use crate::ffi3::object::*;
use crate::ffi::object::*;
use std::os::raw::{c_char, c_int, c_void};
#[cfg_attr(windows, link(name = "pythonXY"))]

View file

@ -1,7 +1,7 @@
use crate::ffi3::object::*;
use crate::ffi::object::*;
#[cfg(PyPy)]
use crate::ffi3::objectabstract::PyObject_CallFunction;
use crate::ffi3::pyport::Py_ssize_t;
use crate::ffi::objectabstract::PyObject_CallFunction;
use crate::ffi::pyport::Py_ssize_t;
#[cfg(PyPy)]
use std::ffi::CStr;
use std::os::raw::{c_char, c_int};

View file

@ -1,4 +1,4 @@
use crate::ffi3::pyport::{Py_hash_t, Py_ssize_t};
use crate::ffi::pyport::{Py_hash_t, Py_ssize_t};
use std::os::raw::{c_char, c_int, c_void};
#[repr(C)]

View file

@ -1,7 +1,7 @@
#[cfg(Py_3_6)]
use crate::ffi3::ceval::_PyFrameEvalFunction;
use crate::ffi3::moduleobject::PyModuleDef;
use crate::ffi3::object::PyObject;
use crate::ffi::ceval::_PyFrameEvalFunction;
use crate::ffi::moduleobject::PyModuleDef;
use crate::ffi::object::PyObject;
use std::os::raw::{c_int, c_long};
#[cfg(Py_3_6)]

View file

@ -1,4 +1,4 @@
use crate::ffi3::object::PyObject;
use crate::ffi::object::PyObject;
use std::os::raw::{c_char, c_double, c_int};
#[cfg_attr(windows, link(name = "pythonXY"))]

View file

@ -1,7 +1,7 @@
use crate::ffi3::object::*;
use crate::ffi::object::*;
#[cfg(not(Py_LIMITED_API))]
use crate::ffi3::pyarena::PyArena;
use crate::ffi3::pystate::PyThreadState;
use crate::ffi::pyarena::PyArena;
use crate::ffi::pystate::PyThreadState;
use libc::{wchar_t, FILE};
use std::os::raw::{c_char, c_int};
use std::ptr;

View file

@ -1,4 +1,4 @@
use crate::ffi3::object::*;
use crate::ffi::object::*;
use std::os::raw::c_int;
#[cfg_attr(windows, link(name = "pythonXY"))]

View file

@ -1,5 +1,5 @@
use crate::ffi3::object::*;
use crate::ffi3::pyport::Py_ssize_t;
use crate::ffi::object::*;
use crate::ffi::pyport::Py_ssize_t;
use std::os::raw::c_int;
#[cfg_attr(windows, link(name = "pythonXY"))]

View file

@ -1,5 +1,5 @@
use crate::ffi3::object::*;
use crate::ffi3::pyport::Py_ssize_t;
use crate::ffi::object::*;
use crate::ffi::pyport::Py_ssize_t;
use std::os::raw::c_int;
#[cfg_attr(windows, link(name = "pythonXY"))]

View file

@ -1,5 +1,5 @@
use crate::ffi3::object::PyObject;
use crate::ffi3::pyport::Py_ssize_t;
use crate::ffi::object::PyObject;
use crate::ffi::pyport::Py_ssize_t;
use std::os::raw::{c_char, c_int};
#[repr(C)]

View file

@ -1,5 +1,5 @@
use crate::ffi3::object::{PyObject, PyTypeObject};
use crate::ffi3::pyport::Py_ssize_t;
use crate::ffi::object::{PyObject, PyTypeObject};
use crate::ffi::pyport::Py_ssize_t;
use std::os::raw::{c_char, c_int};
#[repr(C)]

View file

@ -1,5 +1,5 @@
use crate::ffi3::object::PyObject;
use crate::ffi3::pyport::Py_ssize_t;
use crate::ffi::object::PyObject;
use crate::ffi::pyport::Py_ssize_t;
use libc::wchar_t;
use std::os::raw::{c_char, c_int};

View file

@ -1,10 +1,10 @@
use crate::ffi3::object::*;
use crate::ffi::object::*;
use std::os::raw::c_int;
#[cfg_attr(windows, link(name = "pythonXY"))]
extern "C" {
#[cfg_attr(PyPy, link_name = "PyPyTraceBack_Here")]
pub fn PyTraceBack_Here(arg1: *mut crate::ffi3::PyFrameObject) -> c_int;
pub fn PyTraceBack_Here(arg1: *mut crate::ffi::PyFrameObject) -> c_int;
#[cfg_attr(PyPy, link_name = "PyPyTraceBack_Print")]
pub fn PyTraceBack_Print(arg1: *mut PyObject, arg2: *mut PyObject) -> c_int;
#[cfg_attr(PyPy, link_name = "PyPyTraceBack_Type")]

View file

@ -1,5 +1,5 @@
use crate::ffi3::object::*;
use crate::ffi3::pyport::Py_ssize_t;
use crate::ffi::object::*;
use crate::ffi::pyport::Py_ssize_t;
use std::os::raw::c_int;
#[repr(C)]

View file

@ -1,5 +1,5 @@
use crate::ffi3::object::*;
use crate::ffi3::pyport::Py_ssize_t;
use crate::ffi::object::*;
use crate::ffi::pyport::Py_ssize_t;
use libc::wchar_t;
use std::os::raw::{c_char, c_int, c_void};

View file

@ -1,5 +1,5 @@
use crate::ffi3::object::PyObject;
use crate::ffi3::pyport::Py_ssize_t;
use crate::ffi::object::PyObject;
use crate::ffi::pyport::Py_ssize_t;
use std::os::raw::{c_char, c_int};
#[cfg_attr(windows, link(name = "pythonXY"))]

View file

@ -1,4 +1,4 @@
use crate::ffi3::object::*;
use crate::ffi::object::*;
use std::os::raw::c_int;
pub enum PyWeakReference {}

View file

@ -1,153 +0,0 @@
//! Rust FFI declarations for Python 3
#![allow(non_camel_case_types, non_snake_case, non_upper_case_globals)]
#![cfg_attr(Py_LIMITED_API, allow(unused_imports))]
#![cfg_attr(feature="cargo-clippy", allow(clippy::inline_always))]
pub use self::bltinmodule::*;
pub use self::boolobject::*;
pub use self::bytearrayobject::*;
pub use self::bytesobject::*;
pub use self::ceval::*;
pub use self::code::*;
pub use self::codecs::*;
pub use self::compile::*;
pub use self::complexobject::*;
pub use self::descrobject::*;
pub use self::dictobject::*;
pub use self::enumobject::*;
pub use self::eval::*;
pub use self::fileobject::*;
pub use self::floatobject::*;
pub use self::frameobject::PyFrameObject;
pub use self::genobject::*;
pub use self::import::*;
pub use self::intrcheck::*;
pub use self::iterobject::*;
pub use self::listobject::*;
pub use self::longobject::*;
pub use self::memoryobject::*;
pub use self::methodobject::*;
pub use self::modsupport::*;
pub use self::moduleobject::*;
pub use self::object::*;
pub use self::objectabstract::*;
pub use self::objimpl::*;
#[cfg(Py_3_6)]
pub use self::osmodule::*;
pub use self::pyarena::*;
pub use self::pycapsule::*;
pub use self::pydebug::*;
pub use self::pyerrors::*;
pub use self::pyhash::*;
pub use self::pymem::*;
pub use self::pyport::*;
pub use self::pystate::*;
pub use self::pystrtod::*;
pub use self::pythonrun::*;
pub use self::rangeobject::*;
pub use self::setobject::*;
pub use self::sliceobject::*;
pub use self::structseq::*;
pub use self::sysmodule::*;
pub use self::traceback::*;
pub use self::tupleobject::*;
pub use self::typeslots::*;
pub use self::unicodeobject::*;
pub use self::warnings::*;
pub use self::weakrefobject::*;
mod pyport;
// mod pymacro; contains nothing of interest for Rust
// mod pyatomic; contains nothing of interest for Rust
// mod pymath; contains nothing of interest for Rust
// [cfg(not(Py_LIMITED_API))]
// mod pytime; contains nothing of interest
mod pymem;
mod object;
mod objimpl;
mod pydebug;
mod pyhash;
mod typeslots;
mod bytearrayobject;
mod bytesobject;
mod longobject;
mod unicodeobject; // TODO supports PEP-384 only; needs adjustment for Python 3.3 and 3.5
// mod longintrepr; TODO excluded by PEP-384
mod boolobject; // TODO supports PEP-384 only; needs adjustment for Python 3.3 and 3.5
mod complexobject; // TODO supports PEP-384 only; needs adjustment for Python 3.3 and 3.5
mod dictobject;
mod floatobject; // TODO supports PEP-384 only; needs adjustment for Python 3.3 and 3.5
mod listobject; // TODO supports PEP-384 only; needs adjustment for Python 3.3 and 3.5
mod memoryobject; // TODO supports PEP-384 only; needs adjustment for Python 3.3 and 3.5
mod rangeobject; // TODO supports PEP-384 only; needs adjustment for Python 3.3 and 3.5
mod tupleobject; // TODO supports PEP-384 only; needs adjustment for Python 3.3 and 3.5
// mod odictobject; TODO new in 3.5
mod enumobject; // TODO supports PEP-384 only; needs adjustment for Python 3.3 and 3.5
mod methodobject; // TODO supports PEP-384 only; needs adjustment for Python 3.3 and 3.5
mod moduleobject;
mod setobject; // TODO supports PEP-384 only; needs adjustment for Python 3.3 and 3.5
// mod funcobject; TODO excluded by PEP-384
// mod classobject; TODO excluded by PEP-384
mod fileobject; // TODO supports PEP-384 only; needs adjustment for Python 3.3 and 3.5
mod pycapsule; // TODO supports PEP-384 only; needs adjustment for Python 3.3 and 3.5
mod sliceobject;
mod traceback; // TODO supports PEP-384 only; needs adjustment for Python 3.3 and 3.5
// mod cellobject; TODO excluded by PEP-384
mod descrobject; // TODO supports PEP-384 only; needs adjustment for Python 3.3 and 3.5
mod genobject; // TODO excluded by PEP-384
mod iterobject; // TODO supports PEP-384 only; needs adjustment for Python 3.3 and 3.5
mod structseq;
mod warnings; // TODO supports PEP-384 only; needs adjustment for Python 3.3 and 3.5
mod weakrefobject; // TODO supports PEP-384 only; needs adjustment for Python 3.3 and 3.5
// mod namespaceobject; TODO
mod codecs; // TODO supports PEP-384 only; needs adjustment for Python 3.3 and 3.5
mod pyerrors; // TODO supports PEP-384 only; needs adjustment for Python 3.3 and 3.5
mod pystate; // TODO supports PEP-384 only; needs adjustment for Python 3.3 and 3.5
#[cfg(Py_LIMITED_API)]
mod pyarena {}
mod modsupport; // TODO supports PEP-384 only; needs adjustment for Python 3.3 and 3.5
#[cfg(not(Py_LIMITED_API))]
mod pyarena; // TODO: incomplete
mod pythonrun; // TODO some functions need to be moved to pylifecycle
//mod pylifecycle; // TODO new in 3.5
mod ceval; // TODO supports PEP-384 only; needs adjustment for Python 3.3 and 3.5
mod import;
mod intrcheck; // TODO supports PEP-384 only; needs adjustment for Python 3.3 and 3.5
#[cfg(Py_3_6)]
mod osmodule;
mod sysmodule; // TODO supports PEP-384 only; needs adjustment for Python 3.3 and 3.5
mod bltinmodule;
mod objectabstract; // TODO supports PEP-384 only; needs adjustment for Python 3.3 and 3.5
#[cfg(Py_LIMITED_API)]
mod code {}
#[cfg(not(Py_LIMITED_API))]
mod code;
mod compile; // TODO: incomplete
mod eval; // TODO supports PEP-384 only; needs adjustment for Python 3.3 and 3.5
// mod pyctype; TODO excluded by PEP-384
mod pystrtod; // TODO supports PEP-384 only; needs adjustment for Python 3.3 and 3.5
// mod pystrcmp; TODO nothing interesting for Rust?
// mod dtoa; TODO excluded by PEP-384
// mod fileutils; TODO no public functions?
// mod pyfpe; TODO probably not interesting for rust
// Additional headers that are not exported by Python.h
pub mod structmember; // TODO supports PEP-384 only; needs adjustment for Python 3.3 and 3.5
#[cfg(not(Py_LIMITED_API))]
pub mod frameobject;
#[cfg(Py_LIMITED_API)]
pub mod frameobject {
pub enum PyFrameObject {}
}

View file

@ -149,8 +149,6 @@ pub use unindent;
/// Raw ffi declarations for the c interface of python
pub mod ffi;
mod ffi3;
pub mod buffer;
#[doc(hidden)]
pub mod callback;