1use crate::object::*;
2use crate::pyport::Py_ssize_t;
3use std::os::raw::c_int;
4use std::ptr::addr_of_mut;
5
6#[cfg_attr(windows, link(name = "pythonXY"))]
7extern "C" {
8 #[cfg_attr(PyPy, link_name = "PyPyTuple_Type")]
9 pub static mut PyTuple_Type: PyTypeObject;
10 pub static mut PyTupleIter_Type: PyTypeObject;
11}
12
13#[inline]
14pub unsafe fn PyTuple_Check(op: *mut PyObject) -> c_int {
15 PyType_FastSubclass(t:Py_TYPE(op), Py_TPFLAGS_TUPLE_SUBCLASS)
16}
17
18#[inline]
19pub unsafe fn PyTuple_CheckExact(op: *mut PyObject) -> c_int {
20 (Py_TYPE(ob:op) == addr_of_mut!(PyTuple_Type)) as c_int
21}
22
23extern "C" {
24 #[cfg_attr(PyPy, link_name = "PyPyTuple_New")]
25 pub fn PyTuple_New(size: Py_ssize_t) -> *mut PyObject;
26 #[cfg_attr(PyPy, link_name = "PyPyTuple_Size")]
27 pub fn PyTuple_Size(arg1: *mut PyObject) -> Py_ssize_t;
28 #[cfg_attr(PyPy, link_name = "PyPyTuple_GetItem")]
29 pub fn PyTuple_GetItem(arg1: *mut PyObject, arg2: Py_ssize_t) -> *mut PyObject;
30 #[cfg_attr(PyPy, link_name = "PyPyTuple_SetItem")]
31 pub fn PyTuple_SetItem(arg1: *mut PyObject, arg2: Py_ssize_t, arg3: *mut PyObject) -> c_int;
32 #[cfg_attr(PyPy, link_name = "PyPyTuple_GetSlice")]
33 pub fn PyTuple_GetSlice(
34 arg1: *mut PyObject,
35 arg2: Py_ssize_t,
36 arg3: Py_ssize_t,
37 ) -> *mut PyObject;
38 #[cfg_attr(PyPy, link_name = "PyPyTuple_Pack")]
39 pub fn PyTuple_Pack(arg1: Py_ssize_t, ...) -> *mut PyObject;
40 #[cfg(not(Py_3_9))]
41 pub fn PyTuple_ClearFreeList() -> c_int;
42}
43