Skip to main content

pyo3_ffi/cpython/
longobject.rs

1#[cfg(not(Py_3_13))]
2use crate::longobject::*;
3use crate::object::*;
4
5use core::ffi::c_int;
6
7#[cfg(not(Py_3_13))]
8use core::ffi::c_uchar;
9
10#[cfg(not(Py_3_13))]
11use libc::size_t;
12
13// skipped _PyLong_CAST
14
15extern_libpython! {
16    #[cfg(Py_3_13)]
17    pub fn PyLong_FromUnicodeObject(u: *mut PyObject, base: c_int) -> *mut PyObject;
18
19    // skipped PyUnstable_Long_IsCompact
20    // skipped PyUnstable_Long_CompactValue
21
22    #[cfg(Py_3_14)]
23    pub fn PyLong_IsPositive(obj: *mut PyObject) -> c_int;
24    #[cfg(Py_3_14)]
25    pub fn PyLong_IsNegative(obj: *mut PyObject) -> c_int;
26    #[cfg(Py_3_14)]
27    pub fn PyLong_IsZero(obj: *mut PyObject) -> c_int;
28
29    // skipped PyLong_GetSign
30    // skipped _PyLong_Sign
31    // skipped non-limited _PyLong_NumBits
32
33    #[cfg(not(Py_3_13))]
34    #[cfg_attr(PyPy, link_name = "_PyPyLong_FromByteArray")]
35    #[doc(hidden)] // used in PyO3's older bytes conversions, but not otherwise public API
36    pub fn _PyLong_FromByteArray(
37        bytes: *const c_uchar,
38        n: size_t,
39        little_endian: c_int,
40        is_signed: c_int,
41    ) -> *mut PyObject;
42
43    #[cfg(not(Py_3_13))]
44    #[doc(hidden)] // used in PyO3's older bytes conversions, but not otherwise public API
45    #[cfg_attr(PyPy, link_name = "_PyPyLong_AsByteArrayO")]
46    pub fn _PyLong_AsByteArray(
47        v: *mut PyLongObject,
48        bytes: *mut c_uchar,
49        n: size_t,
50        little_endian: c_int,
51        is_signed: c_int,
52    ) -> c_int;
53
54    // skipped _PyLong_GCD
55}
⚠️ Internal Docs ⚠️ Not Public API 👉 Official Docs Here