Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion Include/cpython/unicodeobject.h
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,8 @@ typedef struct {
unsigned int ascii:1;
/* Padding to ensure that PyUnicode_DATA() is always aligned to
4 bytes (see issue #19537 on m68k). */
unsigned int :25;
unsigned int bstate:4
unsigned int :21;
} state;
} PyASCIIObject;

Expand All @@ -160,6 +161,20 @@ typedef struct {
} data; /* Canonical, smallest-form Unicode buffer */
} PyUnicodeObject;

/* Macros for accessing Pygrate bstate */
#define PyUnicode_GET_BSTATE(op) \
(PyUnicode_IS_COMPACT(op) ? \
((PyCompactUnicodeObject *)(op))->_base.state.bstate : \
((PyUnicodeObject *)(op))->_base._base.state.bstate)

#define PyUnicode_SET_BSTATE(op, val) \
do { \
if (PyUnicode_IS_COMPACT(op)) \
((PyCompactUnicodeObject *)(op))->_base.state.bstate = (val); \
else \
((PyUnicodeObject *)(op))->_base._base.state.bstate = (val); \
} while (0)

PyAPI_FUNC(int) _PyUnicode_CheckConsistency(
PyObject *op,
int check_content);
Expand Down