File tree Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Original file line number Diff line number Diff line change 11Added ` _PyLong_Sign `
2+ Add ` PyBytes_AS_STRING `
Original file line number Diff line number Diff line change 11use crate :: object:: * ;
22use crate :: Py_ssize_t ;
3- #[ cfg( not( any( PyPy , GraalPy , Py_LIMITED_API ) ) ) ]
3+ #[ cfg( not( any( PyPy , Py_LIMITED_API ) ) ) ]
44use std:: os:: raw:: c_char;
55use std:: os:: raw:: c_int;
66
@@ -23,3 +23,11 @@ extern "C" {
2323 #[ cfg_attr( PyPy , link_name = "_PyPyBytes_Resize" ) ]
2424 pub fn _PyBytes_Resize ( bytes : * mut * mut PyObject , newsize : Py_ssize_t ) -> c_int ;
2525}
26+
27+ #[ inline]
28+ pub unsafe fn PyBytes_AS_STRING ( op : * mut PyObject ) -> * const c_char {
29+ #[ cfg( not( any( PyPy , GraalPy , Py_LIMITED_API ) ) ) ]
30+ return & ( * op. cast :: < PyBytesObject > ( ) ) . ob_sval as * const c_char ;
31+ #[ cfg( any( PyPy , GraalPy , Py_LIMITED_API ) ) ]
32+ return crate :: PyBytes_AsString ( op) ;
33+ }
You can’t perform that action at this time.
0 commit comments