diff options
Diffstat (limited to 'Include/unicodeobject.h')
-rw-r--r-- | Include/unicodeobject.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/Include/unicodeobject.h b/Include/unicodeobject.h index 131278d..2a27dbc 100644 --- a/Include/unicodeobject.h +++ b/Include/unicodeobject.h @@ -390,6 +390,9 @@ typedef struct { Py_ssize_t length; /* Length of raw Unicode data in buffer */ Py_UNICODE *str; /* Raw Unicode buffer */ long hash; /* Hash value; -1 if not set */ + int state; /* != 0 if interned. In this case the two + * references from the dictionary to this object + * are *not* counted in ob_refcnt. */ PyObject *defenc; /* (Default) Encoded version as Python string, or NULL; this is used for implementing the buffer protocol */ @@ -397,6 +400,10 @@ typedef struct { PyAPI_DATA(PyTypeObject) PyUnicode_Type; +#define SSTATE_NOT_INTERNED 0 +#define SSTATE_INTERNED_MORTAL 1 +#define SSTATE_INTERNED_IMMORTAL 2 + #define PyUnicode_Check(op) \ PyType_FastSubclass((op)->ob_type, Py_TPFLAGS_UNICODE_SUBCLASS) #define PyUnicode_CheckExact(op) ((op)->ob_type == &PyUnicode_Type) @@ -529,6 +536,14 @@ PyAPI_FUNC(PyObject*) PyUnicode_FromObject( PyAPI_FUNC(PyObject *) PyUnicode_FromFormatV(const char*, va_list); PyAPI_FUNC(PyObject *) PyUnicode_FromFormat(const char*, ...); +PyAPI_FUNC(void) PyUnicode_InternInPlace(PyObject **); +PyAPI_FUNC(void) PyUnicode_InternImmortal(PyObject **); +PyAPI_FUNC(PyObject *) PyUnicode_InternFromString(const char *); +PyAPI_FUNC(void) _Py_ReleaseInternedUnicodeStrings(void); + +/* Use only if you know it's a string */ +#define PyUnicode_CHECK_INTERNED(op) (((PyUnicodeObject *)(op))->state) + /* --- wchar_t support for platforms which support it --------------------- */ #ifdef HAVE_WCHAR_H |