Skip to main content

pyo3_ffi/
unicodeobject.rs

1use crate::object::*;
2use crate::pyport::Py_ssize_t;
3use core::ffi::{c_char, c_int, c_void};
4use libc::wchar_t;
5
6pub type Py_UCS4 = u32;
7pub type Py_UCS2 = u16;
8pub type Py_UCS1 = u8;
9
10extern_libpython! {
11    #[cfg(not(RustPython))]
12    #[cfg_attr(all(PyPy, not(Py_3_12)), link_name = "PyPyUnicode_Type")]
13    pub static mut PyUnicode_Type: PyTypeObject;
14    #[cfg(not(RustPython))]
15    pub static mut PyUnicodeIter_Type: PyTypeObject;
16
17    #[cfg(any(PyPy, RustPython))]
18    #[cfg_attr(PyPy, link_name = "PyPyUnicode_Check")]
19    pub fn PyUnicode_Check(op: *mut PyObject) -> c_int;
20
21    #[cfg(any(PyPy, RustPython))]
22    #[cfg_attr(PyPy, link_name = "PyPyUnicode_CheckExact")]
23    pub fn PyUnicode_CheckExact(op: *mut PyObject) -> c_int;
24}
25
26#[inline]
27#[cfg(not(any(PyPy, RustPython)))]
28pub unsafe fn PyUnicode_Check(op: *mut PyObject) -> c_int {
29    PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_UNICODE_SUBCLASS)
30}
31
32#[inline]
33#[cfg(not(any(PyPy, RustPython)))]
34pub unsafe fn PyUnicode_CheckExact(op: *mut PyObject) -> c_int {
35    Py_IS_TYPE(op, &raw mut PyUnicode_Type)
36}
37
38pub const Py_UNICODE_REPLACEMENT_CHARACTER: Py_UCS4 = 0xFFFD;
39
40extern_libpython! {
41
42    #[cfg_attr(all(PyPy, not(Py_3_12)), link_name = "PyPyUnicode_FromStringAndSize")]
43    pub fn PyUnicode_FromStringAndSize(u: *const c_char, size: Py_ssize_t) -> *mut PyObject;
44    #[cfg_attr(all(PyPy, not(Py_3_12)), link_name = "PyPyUnicode_FromString")]
45    pub fn PyUnicode_FromString(u: *const c_char) -> *mut PyObject;
46
47    #[cfg_attr(all(PyPy, not(Py_3_12)), link_name = "PyPyUnicode_Substring")]
48    pub fn PyUnicode_Substring(
49        str: *mut PyObject,
50        start: Py_ssize_t,
51        end: Py_ssize_t,
52    ) -> *mut PyObject;
53    #[cfg_attr(all(PyPy, not(Py_3_12)), link_name = "PyPyUnicode_AsUCS4")]
54    pub fn PyUnicode_AsUCS4(
55        unicode: *mut PyObject,
56        buffer: *mut Py_UCS4,
57        buflen: Py_ssize_t,
58        copy_null: c_int,
59    ) -> *mut Py_UCS4;
60    #[cfg_attr(all(PyPy, not(Py_3_12)), link_name = "PyPyUnicode_AsUCS4Copy")]
61    pub fn PyUnicode_AsUCS4Copy(unicode: *mut PyObject) -> *mut Py_UCS4;
62    #[cfg_attr(all(PyPy, not(Py_3_12)), link_name = "PyPyUnicode_GetLength")]
63    pub fn PyUnicode_GetLength(unicode: *mut PyObject) -> Py_ssize_t;
64    #[cfg(not(Py_3_12))]
65    #[deprecated(note = "Removed in Python 3.12")]
66    #[cfg_attr(PyPy, link_name = "PyPyUnicode_GetSize")]
67    pub fn PyUnicode_GetSize(unicode: *mut PyObject) -> Py_ssize_t;
68    #[cfg_attr(all(PyPy, not(Py_3_12)), link_name = "PyPyUnicode_ReadChar")]
69    pub fn PyUnicode_ReadChar(unicode: *mut PyObject, index: Py_ssize_t) -> Py_UCS4;
70    #[cfg_attr(all(PyPy, not(Py_3_12)), link_name = "PyPyUnicode_WriteChar")]
71    pub fn PyUnicode_WriteChar(
72        unicode: *mut PyObject,
73        index: Py_ssize_t,
74        character: Py_UCS4,
75    ) -> c_int;
76    #[cfg_attr(all(PyPy, not(Py_3_12)), link_name = "PyPyUnicode_Resize")]
77    pub fn PyUnicode_Resize(unicode: *mut *mut PyObject, length: Py_ssize_t) -> c_int;
78    #[cfg_attr(all(PyPy, not(Py_3_12)), link_name = "PyPyUnicode_FromEncodedObject")]
79    pub fn PyUnicode_FromEncodedObject(
80        obj: *mut PyObject,
81        encoding: *const c_char,
82        errors: *const c_char,
83    ) -> *mut PyObject;
84    #[cfg_attr(all(PyPy, not(Py_3_12)), link_name = "PyPyUnicode_FromObject")]
85    pub fn PyUnicode_FromObject(obj: *mut PyObject) -> *mut PyObject;
86    // #[cfg_attr(PyPy, link_name = "PyPyUnicode_FromFormatV")]
87    // pub fn PyUnicode_FromFormatV(format: *const c_char, vargs: va_list) -> *mut PyObject;
88    #[cfg_attr(all(PyPy, not(Py_3_12)), link_name = "PyPyUnicode_FromFormat")]
89    pub fn PyUnicode_FromFormat(format: *const c_char, ...) -> *mut PyObject;
90    #[cfg_attr(all(PyPy, not(Py_3_12)), link_name = "PyPyUnicode_InternInPlace")]
91    pub fn PyUnicode_InternInPlace(arg1: *mut *mut PyObject);
92    #[cfg(not(Py_3_12))]
93    #[cfg_attr(Py_3_10, deprecated(note = "Python 3.10"))]
94    pub fn PyUnicode_InternImmortal(arg1: *mut *mut PyObject);
95    #[cfg_attr(all(PyPy, not(Py_3_12)), link_name = "PyPyUnicode_InternFromString")]
96    pub fn PyUnicode_InternFromString(u: *const c_char) -> *mut PyObject;
97    #[cfg_attr(all(PyPy, not(Py_3_12)), link_name = "PyPyUnicode_FromWideChar")]
98    pub fn PyUnicode_FromWideChar(w: *const wchar_t, size: Py_ssize_t) -> *mut PyObject;
99    #[cfg_attr(all(PyPy, not(Py_3_12)), link_name = "PyPyUnicode_AsWideChar")]
100    pub fn PyUnicode_AsWideChar(
101        unicode: *mut PyObject,
102        w: *mut wchar_t,
103        size: Py_ssize_t,
104    ) -> Py_ssize_t;
105    #[cfg_attr(all(PyPy, not(Py_3_12)), link_name = "PyPyUnicode_AsWideCharString")]
106    pub fn PyUnicode_AsWideCharString(
107        unicode: *mut PyObject,
108        size: *mut Py_ssize_t,
109    ) -> *mut wchar_t;
110    #[cfg_attr(all(PyPy, not(Py_3_12)), link_name = "PyPyUnicode_FromOrdinal")]
111    pub fn PyUnicode_FromOrdinal(ordinal: c_int) -> *mut PyObject;
112    #[cfg_attr(all(PyPy, not(Py_3_12)), link_name = "PyPyUnicode_GetDefaultEncoding")]
113    pub fn PyUnicode_GetDefaultEncoding() -> *const c_char;
114    #[cfg_attr(all(PyPy, not(Py_3_12)), link_name = "PyPyUnicode_Decode")]
115    pub fn PyUnicode_Decode(
116        s: *const c_char,
117        size: Py_ssize_t,
118        encoding: *const c_char,
119        errors: *const c_char,
120    ) -> *mut PyObject;
121    #[cfg(not(Py_3_15))]
122    #[deprecated(note = "use PyCodec_Decode() instead")]
123    pub fn PyUnicode_AsDecodedObject(
124        unicode: *mut PyObject,
125        encoding: *const c_char,
126        errors: *const c_char,
127    ) -> *mut PyObject;
128    #[cfg(not(Py_3_15))]
129    #[deprecated(note = "use PyCodec_Decode() instead")]
130    pub fn PyUnicode_AsDecodedUnicode(
131        unicode: *mut PyObject,
132        encoding: *const c_char,
133        errors: *const c_char,
134    ) -> *mut PyObject;
135    #[cfg(not(Py_3_15))]
136    #[deprecated(note = "use PyCodec_Encode() instead")]
137    #[cfg_attr(all(PyPy, not(Py_3_12)), link_name = "PyPyUnicode_AsEncodedObject")]
138    pub fn PyUnicode_AsEncodedObject(
139        unicode: *mut PyObject,
140        encoding: *const c_char,
141        errors: *const c_char,
142    ) -> *mut PyObject;
143    #[cfg_attr(all(PyPy, not(Py_3_12)), link_name = "PyPyUnicode_AsEncodedString")]
144    pub fn PyUnicode_AsEncodedString(
145        unicode: *mut PyObject,
146        encoding: *const c_char,
147        errors: *const c_char,
148    ) -> *mut PyObject;
149    #[cfg(not(Py_3_15))]
150    #[deprecated(note = "use PyCodec_Encode() instead")]
151    pub fn PyUnicode_AsEncodedUnicode(
152        unicode: *mut PyObject,
153        encoding: *const c_char,
154        errors: *const c_char,
155    ) -> *mut PyObject;
156    pub fn PyUnicode_BuildEncodingMap(string: *mut PyObject) -> *mut PyObject;
157    pub fn PyUnicode_DecodeUTF7(
158        string: *const c_char,
159        length: Py_ssize_t,
160        errors: *const c_char,
161    ) -> *mut PyObject;
162    pub fn PyUnicode_DecodeUTF7Stateful(
163        string: *const c_char,
164        length: Py_ssize_t,
165        errors: *const c_char,
166        consumed: *mut Py_ssize_t,
167    ) -> *mut PyObject;
168    #[cfg_attr(all(PyPy, not(Py_3_12)), link_name = "PyPyUnicode_DecodeUTF8")]
169    pub fn PyUnicode_DecodeUTF8(
170        string: *const c_char,
171        length: Py_ssize_t,
172        errors: *const c_char,
173    ) -> *mut PyObject;
174    pub fn PyUnicode_DecodeUTF8Stateful(
175        string: *const c_char,
176        length: Py_ssize_t,
177        errors: *const c_char,
178        consumed: *mut Py_ssize_t,
179    ) -> *mut PyObject;
180    #[cfg_attr(all(PyPy, not(Py_3_12)), link_name = "PyPyUnicode_AsUTF8String")]
181    pub fn PyUnicode_AsUTF8String(unicode: *mut PyObject) -> *mut PyObject;
182    #[cfg(any(Py_3_10, not(Py_LIMITED_API)))]
183    #[cfg_attr(all(PyPy, not(Py_3_12)), link_name = "PyPyUnicode_AsUTF8AndSize")]
184    pub fn PyUnicode_AsUTF8AndSize(unicode: *mut PyObject, size: *mut Py_ssize_t) -> *const c_char;
185    #[cfg_attr(all(PyPy, not(Py_3_12)), link_name = "PyPyUnicode_DecodeUTF32")]
186    pub fn PyUnicode_DecodeUTF32(
187        string: *const c_char,
188        length: Py_ssize_t,
189        errors: *const c_char,
190        byteorder: *mut c_int,
191    ) -> *mut PyObject;
192    pub fn PyUnicode_DecodeUTF32Stateful(
193        string: *const c_char,
194        length: Py_ssize_t,
195        errors: *const c_char,
196        byteorder: *mut c_int,
197        consumed: *mut Py_ssize_t,
198    ) -> *mut PyObject;
199    #[cfg_attr(all(PyPy, not(Py_3_12)), link_name = "PyPyUnicode_AsUTF32String")]
200    pub fn PyUnicode_AsUTF32String(unicode: *mut PyObject) -> *mut PyObject;
201    #[cfg_attr(all(PyPy, not(Py_3_12)), link_name = "PyPyUnicode_DecodeUTF16")]
202    pub fn PyUnicode_DecodeUTF16(
203        string: *const c_char,
204        length: Py_ssize_t,
205        errors: *const c_char,
206        byteorder: *mut c_int,
207    ) -> *mut PyObject;
208    pub fn PyUnicode_DecodeUTF16Stateful(
209        string: *const c_char,
210        length: Py_ssize_t,
211        errors: *const c_char,
212        byteorder: *mut c_int,
213        consumed: *mut Py_ssize_t,
214    ) -> *mut PyObject;
215    #[cfg_attr(all(PyPy, not(Py_3_12)), link_name = "PyPyUnicode_AsUTF16String")]
216    pub fn PyUnicode_AsUTF16String(unicode: *mut PyObject) -> *mut PyObject;
217    pub fn PyUnicode_DecodeUnicodeEscape(
218        string: *const c_char,
219        length: Py_ssize_t,
220        errors: *const c_char,
221    ) -> *mut PyObject;
222    #[cfg_attr(
223        all(PyPy, not(Py_3_12)),
224        link_name = "PyPyUnicode_AsUnicodeEscapeString"
225    )]
226    pub fn PyUnicode_AsUnicodeEscapeString(unicode: *mut PyObject) -> *mut PyObject;
227    #[cfg_attr(
228        all(PyPy, not(Py_3_12)),
229        link_name = "PyPyUnicode_DecodeRawUnicodeEscape"
230    )]
231    pub fn PyUnicode_DecodeRawUnicodeEscape(
232        string: *const c_char,
233        length: Py_ssize_t,
234        errors: *const c_char,
235    ) -> *mut PyObject;
236    #[cfg_attr(
237        all(PyPy, not(Py_3_12)),
238        link_name = "PyPyUnicode_AsRawUnicodeEscapeString"
239    )]
240    pub fn PyUnicode_AsRawUnicodeEscapeString(unicode: *mut PyObject) -> *mut PyObject;
241    #[cfg_attr(all(PyPy, not(Py_3_12)), link_name = "PyPyUnicode_DecodeLatin1")]
242    pub fn PyUnicode_DecodeLatin1(
243        string: *const c_char,
244        length: Py_ssize_t,
245        errors: *const c_char,
246    ) -> *mut PyObject;
247    #[cfg_attr(all(PyPy, not(Py_3_12)), link_name = "PyPyUnicode_AsLatin1String")]
248    pub fn PyUnicode_AsLatin1String(unicode: *mut PyObject) -> *mut PyObject;
249    #[cfg_attr(all(PyPy, not(Py_3_12)), link_name = "PyPyUnicode_DecodeASCII")]
250    pub fn PyUnicode_DecodeASCII(
251        string: *const c_char,
252        length: Py_ssize_t,
253        errors: *const c_char,
254    ) -> *mut PyObject;
255    #[cfg_attr(all(PyPy, not(Py_3_12)), link_name = "PyPyUnicode_AsASCIIString")]
256    pub fn PyUnicode_AsASCIIString(unicode: *mut PyObject) -> *mut PyObject;
257    pub fn PyUnicode_DecodeCharmap(
258        string: *const c_char,
259        length: Py_ssize_t,
260        mapping: *mut PyObject,
261        errors: *const c_char,
262    ) -> *mut PyObject;
263    pub fn PyUnicode_AsCharmapString(
264        unicode: *mut PyObject,
265        mapping: *mut PyObject,
266    ) -> *mut PyObject;
267    #[cfg(target_os = "windows")]
268    #[cfg_attr(all(PyPy, not(Py_3_12)), link_name = "PyPyUnicode_DecodeMBCS")]
269    pub fn PyUnicode_DecodeMBCS(
270        string: *const c_char,
271        length: Py_ssize_t,
272        errors: *const c_char,
273    ) -> *mut PyObject;
274    #[cfg(target_os = "windows")]
275    pub fn PyUnicode_DecodeMBCSStateful(
276        string: *const c_char,
277        length: Py_ssize_t,
278        errors: *const c_char,
279        consumed: *mut Py_ssize_t,
280    ) -> *mut PyObject;
281    #[cfg(target_os = "windows")]
282    pub fn PyUnicode_DecodeCodePageStateful(
283        code_page: c_int,
284        string: *const c_char,
285        length: Py_ssize_t,
286        errors: *const c_char,
287        consumed: *mut Py_ssize_t,
288    ) -> *mut PyObject;
289    #[cfg(target_os = "windows")]
290    #[cfg_attr(all(PyPy, not(Py_3_12)), link_name = "PyPyUnicode_AsMBCSString")]
291    pub fn PyUnicode_AsMBCSString(unicode: *mut PyObject) -> *mut PyObject;
292    #[cfg(target_os = "windows")]
293    #[cfg_attr(all(PyPy, not(Py_3_12)), link_name = "PyPyUnicode_EncodeCodePage")]
294    pub fn PyUnicode_EncodeCodePage(
295        code_page: c_int,
296        unicode: *mut PyObject,
297        errors: *const c_char,
298    ) -> *mut PyObject;
299    #[cfg_attr(all(PyPy, not(Py_3_12)), link_name = "PyPyUnicode_DecodeLocaleAndSize")]
300    pub fn PyUnicode_DecodeLocaleAndSize(
301        str: *const c_char,
302        len: Py_ssize_t,
303        errors: *const c_char,
304    ) -> *mut PyObject;
305    #[cfg_attr(all(PyPy, not(Py_3_12)), link_name = "PyPyUnicode_DecodeLocale")]
306    pub fn PyUnicode_DecodeLocale(str: *const c_char, errors: *const c_char) -> *mut PyObject;
307    #[cfg_attr(all(PyPy, not(Py_3_12)), link_name = "PyPyUnicode_EncodeLocale")]
308    pub fn PyUnicode_EncodeLocale(unicode: *mut PyObject, errors: *const c_char) -> *mut PyObject;
309    #[cfg_attr(all(PyPy, not(Py_3_12)), link_name = "PyPyUnicode_FSConverter")]
310    pub fn PyUnicode_FSConverter(arg1: *mut PyObject, arg2: *mut c_void) -> c_int;
311    #[cfg_attr(all(PyPy, not(Py_3_12)), link_name = "PyPyUnicode_FSDecoder")]
312    pub fn PyUnicode_FSDecoder(arg1: *mut PyObject, arg2: *mut c_void) -> c_int;
313    #[cfg_attr(all(PyPy, not(Py_3_12)), link_name = "PyPyUnicode_DecodeFSDefault")]
314    pub fn PyUnicode_DecodeFSDefault(s: *const c_char) -> *mut PyObject;
315    #[cfg_attr(
316        all(PyPy, not(Py_3_12)),
317        link_name = "PyPyUnicode_DecodeFSDefaultAndSize"
318    )]
319    pub fn PyUnicode_DecodeFSDefaultAndSize(s: *const c_char, size: Py_ssize_t) -> *mut PyObject;
320    #[cfg_attr(all(PyPy, not(Py_3_12)), link_name = "PyPyUnicode_EncodeFSDefault")]
321    pub fn PyUnicode_EncodeFSDefault(unicode: *mut PyObject) -> *mut PyObject;
322    #[cfg_attr(all(PyPy, not(Py_3_12)), link_name = "PyPyUnicode_Concat")]
323    pub fn PyUnicode_Concat(left: *mut PyObject, right: *mut PyObject) -> *mut PyObject;
324    #[cfg_attr(all(PyPy, not(Py_3_12)), link_name = "PyPyUnicode_Append")]
325    pub fn PyUnicode_Append(pleft: *mut *mut PyObject, right: *mut PyObject);
326    #[cfg_attr(all(PyPy, not(Py_3_12)), link_name = "PyPyUnicode_AppendAndDel")]
327    pub fn PyUnicode_AppendAndDel(pleft: *mut *mut PyObject, right: *mut PyObject);
328    #[cfg_attr(all(PyPy, not(Py_3_12)), link_name = "PyPyUnicode_Split")]
329    pub fn PyUnicode_Split(
330        s: *mut PyObject,
331        sep: *mut PyObject,
332        maxsplit: Py_ssize_t,
333    ) -> *mut PyObject;
334    #[cfg_attr(all(PyPy, not(Py_3_12)), link_name = "PyPyUnicode_Splitlines")]
335    pub fn PyUnicode_Splitlines(s: *mut PyObject, keepends: c_int) -> *mut PyObject;
336    pub fn PyUnicode_Partition(s: *mut PyObject, sep: *mut PyObject) -> *mut PyObject;
337    pub fn PyUnicode_RPartition(s: *mut PyObject, sep: *mut PyObject) -> *mut PyObject;
338    pub fn PyUnicode_RSplit(
339        s: *mut PyObject,
340        sep: *mut PyObject,
341        maxsplit: Py_ssize_t,
342    ) -> *mut PyObject;
343    pub fn PyUnicode_Translate(
344        str: *mut PyObject,
345        table: *mut PyObject,
346        errors: *const c_char,
347    ) -> *mut PyObject;
348    #[cfg_attr(all(PyPy, not(Py_3_12)), link_name = "PyPyUnicode_Join")]
349    pub fn PyUnicode_Join(separator: *mut PyObject, seq: *mut PyObject) -> *mut PyObject;
350}
351
352#[cfg(all(PyPy, not(Py_3_12)))]
353type TailmatchResult = c_int;
354
355#[cfg(not(all(PyPy, not(Py_3_12))))]
356type TailmatchResult = Py_ssize_t;
357
358extern_libpython! {
359    #[cfg_attr(all(PyPy, not(Py_3_12)), link_name = "PyPyUnicode_Tailmatch")]
360    pub fn PyUnicode_Tailmatch(
361        str: *mut PyObject,
362        substr: *mut PyObject,
363        start: Py_ssize_t,
364        end: Py_ssize_t,
365        direction: c_int,
366    ) -> TailmatchResult;
367    #[cfg_attr(all(PyPy, not(Py_3_12)), link_name = "PyPyUnicode_Find")]
368    pub fn PyUnicode_Find(
369        str: *mut PyObject,
370        substr: *mut PyObject,
371        start: Py_ssize_t,
372        end: Py_ssize_t,
373        direction: c_int,
374    ) -> Py_ssize_t;
375    #[cfg_attr(all(PyPy, not(Py_3_12)), link_name = "PyPyUnicode_FindChar")]
376    pub fn PyUnicode_FindChar(
377        str: *mut PyObject,
378        ch: Py_UCS4,
379        start: Py_ssize_t,
380        end: Py_ssize_t,
381        direction: c_int,
382    ) -> Py_ssize_t;
383    #[cfg_attr(all(PyPy, not(Py_3_12)), link_name = "PyPyUnicode_Count")]
384    pub fn PyUnicode_Count(
385        str: *mut PyObject,
386        substr: *mut PyObject,
387        start: Py_ssize_t,
388        end: Py_ssize_t,
389    ) -> Py_ssize_t;
390    #[cfg_attr(all(PyPy, not(Py_3_12)), link_name = "PyPyUnicode_Replace")]
391    pub fn PyUnicode_Replace(
392        str: *mut PyObject,
393        substr: *mut PyObject,
394        replstr: *mut PyObject,
395        maxcount: Py_ssize_t,
396    ) -> *mut PyObject;
397    #[cfg_attr(all(PyPy, not(Py_3_12)), link_name = "PyPyUnicode_Compare")]
398    pub fn PyUnicode_Compare(left: *mut PyObject, right: *mut PyObject) -> c_int;
399    #[cfg_attr(
400        all(PyPy, not(Py_3_12)),
401        link_name = "PyPyUnicode_CompareWithASCIIString"
402    )]
403    pub fn PyUnicode_CompareWithASCIIString(left: *mut PyObject, right: *const c_char) -> c_int;
404    #[cfg(Py_3_13)]
405    pub fn PyUnicode_EqualToUTF8(unicode: *mut PyObject, string: *const c_char) -> c_int;
406    #[cfg(Py_3_13)]
407    pub fn PyUnicode_EqualToUTF8AndSize(
408        unicode: *mut PyObject,
409        string: *const c_char,
410        size: Py_ssize_t,
411    ) -> c_int;
412    #[cfg(Py_3_14)]
413    pub fn PyUnicode_Equal(str1: *mut PyObject, str2: *mut PyObject) -> c_int;
414    #[cfg_attr(all(PyPy, not(Py_3_12)), link_name = "PyPyUnicode_RichCompare")]
415    pub fn PyUnicode_RichCompare(
416        left: *mut PyObject,
417        right: *mut PyObject,
418        op: c_int,
419    ) -> *mut PyObject;
420    #[cfg_attr(all(PyPy, not(Py_3_12)), link_name = "PyPyUnicode_Format")]
421    pub fn PyUnicode_Format(format: *mut PyObject, args: *mut PyObject) -> *mut PyObject;
422    #[cfg_attr(all(PyPy, not(Py_3_12)), link_name = "PyPyUnicode_Contains")]
423    pub fn PyUnicode_Contains(container: *mut PyObject, element: *mut PyObject) -> c_int;
424    #[cfg_attr(all(PyPy, not(Py_3_12)), link_name = "PyPyUnicode_IsIdentifier")]
425    pub fn PyUnicode_IsIdentifier(s: *mut PyObject) -> c_int;
426}