ffi module cleanup: genobject.h to iterobject.rs
This commit is contained in:
parent
fb9ad1e904
commit
0701bf9948
|
@ -8,6 +8,7 @@ pub mod code;
|
|||
pub mod dictobject;
|
||||
// skipped fileobject.h
|
||||
pub mod frameobject;
|
||||
// skipped import.h
|
||||
|
||||
pub use self::abstract_::*;
|
||||
#[cfg(not(PyPy))]
|
||||
|
|
|
@ -35,35 +35,66 @@ pub unsafe fn PyGen_CheckExact(op: *mut PyObject) -> c_int {
|
|||
|
||||
extern "C" {
|
||||
pub fn PyGen_New(frame: *mut PyFrameObject) -> *mut PyObject;
|
||||
// skipped PyGen_New
|
||||
// skipped PyGen_NewWithQualName
|
||||
// skipped _PyGen_SetStopIterationValue
|
||||
// skipped _PyGen_FetchStopIterationValue
|
||||
// skipped _PyGen_yf
|
||||
// skipped _PyGen_Finalize
|
||||
#[cfg(not(Py_3_9))]
|
||||
#[deprecated(note = "This function was never documented in the Python API.")]
|
||||
pub fn PyGen_NeedsFinalizing(op: *mut PyGenObject) -> c_int;
|
||||
}
|
||||
|
||||
// skipped PyCoroObject
|
||||
|
||||
#[cfg_attr(windows, link(name = "pythonXY"))]
|
||||
extern "C" {
|
||||
pub static mut PyCoro_Type: PyTypeObject;
|
||||
pub static mut _PyCoroWrapper_Type: PyTypeObject;
|
||||
}
|
||||
|
||||
#[deprecated(since = "0.14.0", note = "use PyCoro_CheckExact instead")]
|
||||
#[inline]
|
||||
pub unsafe fn PyCoro_Check(op: *mut PyObject) -> c_int {
|
||||
PyObject_TypeCheck(op, &mut PyCoro_Type)
|
||||
}
|
||||
|
||||
#[cfg_attr(windows, link(name = "pythonXY"))]
|
||||
extern "C" {
|
||||
pub static mut _PyCoroWrapper_Type: PyTypeObject;
|
||||
#[inline]
|
||||
pub unsafe fn PyCoro_CheckExact(op: *mut PyObject) -> c_int {
|
||||
PyObject_TypeCheck(op, &mut PyCoro_Type)
|
||||
}
|
||||
|
||||
#[deprecated(since = "0.14.0", note = "not in Python API")]
|
||||
#[inline]
|
||||
pub unsafe fn PyCoroWrapper_Check(op: *mut PyObject) -> c_int {
|
||||
PyObject_TypeCheck(op, &mut _PyCoroWrapper_Type)
|
||||
}
|
||||
|
||||
// skipped _PyCoro_GetAwaitableIter
|
||||
// skipped PyCoro_New
|
||||
|
||||
// skipped PyAsyncGenObject
|
||||
|
||||
#[cfg_attr(windows, link(name = "pythonXY"))]
|
||||
extern "C" {
|
||||
pub static mut PyAsyncGen_Type: PyTypeObject;
|
||||
// skipped _PyAsyncGenASend_Type
|
||||
// skipped _PyAsyncGenWrappedValue_Type
|
||||
// skipped _PyAsyncGenAThrow_Type
|
||||
}
|
||||
|
||||
// skipped PyAsyncGen_New
|
||||
|
||||
#[deprecated(since = "0.14.0", note = "use PyCoro_CheckExact instead")]
|
||||
#[inline]
|
||||
pub unsafe fn PyAsyncGen_Check(op: *mut PyObject) -> c_int {
|
||||
PyObject_TypeCheck(op, &mut PyAsyncGen_Type)
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub unsafe fn PyAsyncGen_CheckExact(op: *mut PyObject) -> c_int {
|
||||
PyObject_TypeCheck(op, &mut PyAsyncGen_Type)
|
||||
}
|
||||
|
||||
// skipped _PyAsyncGenValueWrapperNew
|
||||
|
|
|
@ -26,6 +26,7 @@ extern "C" {
|
|||
) -> *mut PyObject;
|
||||
#[cfg_attr(PyPy, link_name = "PyPyImport_GetModuleDict")]
|
||||
pub fn PyImport_GetModuleDict() -> *mut PyObject;
|
||||
// skipped Python 3.7 / ex-non-limited PyImport_GetModule
|
||||
pub fn PyImport_AddModuleObject(name: *mut PyObject) -> *mut PyObject;
|
||||
#[cfg_attr(PyPy, link_name = "PyPyImport_AddModule")]
|
||||
pub fn PyImport_AddModule(name: *const c_char) -> *mut PyObject;
|
||||
|
@ -67,6 +68,11 @@ extern "C" {
|
|||
pub fn PyImport_Import(name: *mut PyObject) -> *mut PyObject;
|
||||
#[cfg_attr(PyPy, link_name = "PyPyImport_ReloadModule")]
|
||||
pub fn PyImport_ReloadModule(m: *mut PyObject) -> *mut PyObject;
|
||||
#[cfg(not(Py_3_9))]
|
||||
#[deprecated(
|
||||
since = "0.14.0",
|
||||
note = "Removed in Python 3.9 as it was \"For internal use only\"."
|
||||
)]
|
||||
pub fn PyImport_Cleanup();
|
||||
pub fn PyImport_ImportFrozenModuleObject(name: *mut PyObject) -> c_int;
|
||||
pub fn PyImport_ImportFrozenModule(name: *const c_char) -> c_int;
|
||||
|
|
|
@ -3,7 +3,23 @@ use std::os::raw::c_int;
|
|||
extern "C" {
|
||||
#[cfg_attr(PyPy, link_name = "PyPyOS_InterruptOccurred")]
|
||||
pub fn PyOS_InterruptOccurred() -> c_int;
|
||||
#[cfg(not(Py_3_10))]
|
||||
#[deprecated(
|
||||
since = "0.14.0",
|
||||
note = "Not documented in Python API; see Python 3.10 release notes"
|
||||
)]
|
||||
pub fn PyOS_InitInterrupts();
|
||||
|
||||
#[cfg(any(not(Py_LIMITED_API), Py_3_7))]
|
||||
pub fn PyOS_BeforeFork();
|
||||
#[cfg(any(not(Py_LIMITED_API), Py_3_7))]
|
||||
pub fn PyOS_AfterFork_Parent();
|
||||
#[cfg(any(not(Py_LIMITED_API), Py_3_7))]
|
||||
pub fn PyOS_AfterFork_Child();
|
||||
#[cfg_attr(Py_3_7, deprecated(note = "use PyOS_AfterFork_Child instead"))]
|
||||
#[cfg_attr(PyPy, link_name = "PyPyOS_AfterFork")]
|
||||
pub fn PyOS_AfterFork();
|
||||
|
||||
// skipped non-limited _PyOS_IsMainThread
|
||||
// skipped non-limited Windows _PyOS_SigintEvent
|
||||
}
|
||||
|
|
|
@ -7,19 +7,22 @@ extern "C" {
|
|||
pub static mut PyCallIter_Type: PyTypeObject;
|
||||
}
|
||||
|
||||
extern "C" {
|
||||
#[cfg_attr(PyPy, link_name = "PyPySeqIter_New")]
|
||||
pub fn PySeqIter_New(arg1: *mut PyObject) -> *mut PyObject;
|
||||
#[cfg_attr(PyPy, link_name = "PyPyCallIter_New")]
|
||||
pub fn PyCallIter_New(arg1: *mut PyObject, arg2: *mut PyObject) -> *mut PyObject;
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub unsafe fn PySeqIter_Check(op: *mut PyObject) -> c_int {
|
||||
(Py_TYPE(op) == &mut PySeqIter_Type) as c_int
|
||||
}
|
||||
|
||||
extern "C" {
|
||||
#[cfg_attr(PyPy, link_name = "PyPySeqIter_New")]
|
||||
pub fn PySeqIter_New(arg1: *mut PyObject) -> *mut PyObject;
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub unsafe fn PyCallIter_Check(op: *mut PyObject) -> c_int {
|
||||
(Py_TYPE(op) == &mut PyCallIter_Type) as c_int
|
||||
}
|
||||
|
||||
extern "C" {
|
||||
#[cfg_attr(PyPy, link_name = "PyPyCallIter_New")]
|
||||
pub fn PyCallIter_New(arg1: *mut PyObject, arg2: *mut PyObject) -> *mut PyObject;
|
||||
}
|
||||
|
|
|
@ -31,6 +31,7 @@ pub use self::eval::*;
|
|||
pub use self::fileobject::*;
|
||||
pub use self::floatobject::*;
|
||||
pub use self::funcobject::*;
|
||||
#[cfg(not(Py_LIMITED_API))]
|
||||
pub use self::genobject::*;
|
||||
pub use self::import::*;
|
||||
#[cfg(all(Py_3_8, not(any(PY_LIMITED_API, PyPy))))]
|
||||
|
@ -111,7 +112,15 @@ mod floatobject; // TODO supports PEP-384 only
|
|||
|
||||
// skipped empty frameobject.h
|
||||
// skipped genericaliasobject.h
|
||||
#[cfg(not(Py_LIMITED_API))]
|
||||
mod genobject; // TODO: incomplete
|
||||
mod import; // TODO: incomplete
|
||||
|
||||
// skipped interpreteridobject.h
|
||||
mod intrcheck; // TODO supports PEP-384 only
|
||||
mod iterobject;
|
||||
mod listobject; // TODO supports PEP-384 only; needs adjustment for Python 3.3 and 3.5
|
||||
|
||||
// skipped longintrepr.h
|
||||
// skipped namespaceobject.h
|
||||
// skipped odictobject.h
|
||||
|
@ -158,7 +167,6 @@ mod typeslots;
|
|||
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 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
|
||||
|
@ -170,11 +178,8 @@ mod setobject; // TODO supports PEP-384 only; needs adjustment for Python 3.3 an
|
|||
// mod classobject; TODO excluded by PEP-384
|
||||
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 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 traceback; // TODO supports PEP-384 only; needs adjustment for Python 3.3 and 3.5
|
||||
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
|
||||
|
||||
|
@ -189,8 +194,6 @@ mod modsupport; // TODO supports PEP-384 only; needs adjustment for Python 3.3 a
|
|||
mod pyarena; // TODO: incomplete
|
||||
mod pythonrun; // TODO some functions need to be moved to pylifecycle
|
||||
//mod pylifecycle; // TODO new in 3.5
|
||||
mod import;
|
||||
mod intrcheck; // TODO supports PEP-384 only; needs adjustment for Python 3.3 and 3.5
|
||||
mod osmodule;
|
||||
mod sysmodule; // TODO supports PEP-384 only; needs adjustment for Python 3.3 and 3.5
|
||||
|
||||
|
|
Loading…
Reference in New Issue