1 #ifndef Py_INTERNAL_UNICODEOBJECT_H
2 #define Py_INTERNAL_UNICODEOBJECT_H
3 #ifdef __cplusplus
4 extern "C" {
5 #endif
6 
7 #ifndef Py_BUILD_CORE
8 #  error "this header requires Py_BUILD_CORE define"
9 #endif
10 
11 #include "pycore_fileutils.h"     // _Py_error_handler
12 
13 void _PyUnicode_ExactDealloc(PyObject *op);
14 
15 /* runtime lifecycle */
16 
17 extern void _PyUnicode_InitState(PyInterpreterState *);
18 extern PyStatus _PyUnicode_InitGlobalObjects(PyInterpreterState *);
19 extern PyStatus _PyUnicode_InitTypes(PyInterpreterState *);
20 extern void _PyUnicode_Fini(PyInterpreterState *);
21 extern void _PyUnicode_FiniTypes(PyInterpreterState *);
22 extern void _PyStaticUnicode_Dealloc(PyObject *);
23 
24 extern PyTypeObject _PyUnicodeASCIIIter_Type;
25 
26 /* other API */
27 
28 struct _Py_unicode_runtime_ids {
29     PyThread_type_lock lock;
30     // next_index value must be preserved when Py_Initialize()/Py_Finalize()
31     // is called multiple times: see _PyUnicode_FromId() implementation.
32     Py_ssize_t next_index;
33 };
34 
35 /* fs_codec.encoding is initialized to NULL.
36    Later, it is set to a non-NULL string by _PyUnicode_InitEncodings(). */
37 struct _Py_unicode_fs_codec {
38     char *encoding;   // Filesystem encoding (encoded to UTF-8)
39     int utf8;         // encoding=="utf-8"?
40     char *errors;     // Filesystem errors (encoded to UTF-8)
41     _Py_error_handler error_handler;
42 };
43 
44 struct _Py_unicode_ids {
45     Py_ssize_t size;
46     PyObject **array;
47 };
48 
49 struct _Py_unicode_state {
50     struct _Py_unicode_fs_codec fs_codec;
51 
52     // Unicode identifiers (_Py_Identifier): see _PyUnicode_FromId()
53     struct _Py_unicode_ids ids;
54 };
55 
56 extern void _PyUnicode_ClearInterned(PyInterpreterState *interp);
57 
58 
59 #ifdef __cplusplus
60 }
61 #endif
62 #endif /* !Py_INTERNAL_UNICODEOBJECT_H */
63