1use crate::object::*;
2use crate::pyport::Py_ssize_t;
3use std::os::raw::{c_char, c_int};
4use std::ptr::addr_of_mut;
5
6#[cfg_attr(windows, link(name = "pythonXY"))]
7extern "C" {
8 #[cfg_attr(PyPy, link_name = "PyPyBytes_Type")]
9 pub static mut PyBytes_Type: PyTypeObject;
10 pub static mut PyBytesIter_Type: PyTypeObject;
11}
12
13#[inline]
14pub unsafe fn PyBytes_Check(op: *mut PyObject) -> c_int {
15 PyType_FastSubclass(t:Py_TYPE(op), Py_TPFLAGS_BYTES_SUBCLASS)
16}
17
18#[inline]
19pub unsafe fn PyBytes_CheckExact(op: *mut PyObject) -> c_int {
20 (Py_TYPE(ob:op) == addr_of_mut!(PyBytes_Type)) as c_int
21}
22
23extern "C" {
24 #[cfg_attr(PyPy, link_name = "PyPyBytes_FromStringAndSize")]
25 pub fn PyBytes_FromStringAndSize(arg1: *const c_char, arg2: Py_ssize_t) -> *mut PyObject;
26 pub fn PyBytes_FromString(arg1: *const c_char) -> *mut PyObject;
27 #[cfg_attr(PyPy, link_name = "PyPyBytes_FromObject")]
28 pub fn PyBytes_FromObject(arg1: *mut PyObject) -> *mut PyObject;
29 // skipped PyBytes_FromFormatV
30 //#[cfg_attr(PyPy, link_name = "PyPyBytes_FromFormatV")]
31 //pub fn PyBytes_FromFormatV(arg1: *const c_char, arg2: va_list)
32 // -> *mut PyObject;
33 #[cfg_attr(PyPy, link_name = "PyPyBytes_FromFormat")]
34 pub fn PyBytes_FromFormat(arg1: *const c_char, ...) -> *mut PyObject;
35 #[cfg_attr(PyPy, link_name = "PyPyBytes_Size")]
36 pub fn PyBytes_Size(arg1: *mut PyObject) -> Py_ssize_t;
37 #[cfg_attr(PyPy, link_name = "PyPyBytes_AsString")]
38 pub fn PyBytes_AsString(arg1: *mut PyObject) -> *mut c_char;
39 pub fn PyBytes_Repr(arg1: *mut PyObject, arg2: c_int) -> *mut PyObject;
40 #[cfg_attr(PyPy, link_name = "PyPyBytes_Concat")]
41 pub fn PyBytes_Concat(arg1: *mut *mut PyObject, arg2: *mut PyObject);
42 #[cfg_attr(PyPy, link_name = "PyPyBytes_ConcatAndDel")]
43 pub fn PyBytes_ConcatAndDel(arg1: *mut *mut PyObject, arg2: *mut PyObject);
44 pub fn PyBytes_DecodeEscape(
45 arg1: *const c_char,
46 arg2: Py_ssize_t,
47 arg3: *const c_char,
48 arg4: Py_ssize_t,
49 arg5: *const c_char,
50 ) -> *mut PyObject;
51 #[cfg_attr(PyPy, link_name = "PyPyBytes_AsStringAndSize")]
52 pub fn PyBytes_AsStringAndSize(
53 obj: *mut PyObject,
54 s: *mut *mut c_char,
55 len: *mut Py_ssize_t,
56 ) -> c_int;
57}
58
59// skipped F_LJUST
60// skipped F_SIGN
61// skipped F_BLANK
62// skipped F_ALT
63// skipped F_ZERO
64