MCPcopy Create free account
hub / github.com/dgrunwald/rust-cpython / PyUnicode_DATA

Function PyUnicode_DATA

python3-sys/src/unicodeobject.rs:506–523  ·  view source on GitHub ↗
(o: *mut PyObject)

Source from the content-addressed store, hash-verified

504
505#[cfg(not(Py_LIMITED_API))]
506pub unsafe fn PyUnicode_DATA(o: *mut PyObject) -> *mut c_void {
507 debug_assert!(PyUnicode_Check(o) > 0);
508 #[cfg(not(Py_3_12))]
509 debug_assert!(PyUnicode_IS_READY(o));
510 if PyUnicode_IS_COMPACT(o) {
511 // fn _PyUnicode_COMPACT_DATA
512 if PyUnicode_IS_ASCII(o) {
513 (o as *mut PyASCIIObject).offset(1) as *mut c_void
514 } else {
515 (o as *mut PyCompactUnicodeObject).offset(1) as *mut c_void
516 }
517 } else {
518 // fn _PyUnicode_NONCOMPACT_DATA
519 let data = (*(o as *mut PyUnicodeObject)).data;
520 debug_assert!(!data.is_null());
521 data
522 }
523}
524
525#[cfg(not(Py_LIMITED_API))]
526#[inline]

Callers 1

data_implMethod · 0.85

Calls 2

PyUnicode_IS_COMPACTFunction · 0.85
PyUnicode_IS_ASCIIFunction · 0.85

Tested by

no test coverage detected