Skip to content

Commit d10dcdc

Browse files
committed
Make the structs PyUnstable
1 parent e247c74 commit d10dcdc

File tree

2 files changed

+17
-14
lines changed

2 files changed

+17
-14
lines changed

Include/cpython/unicodeobject.h

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -160,43 +160,46 @@ typedef struct {
160160
unsigned int :24;
161161
#endif
162162
} state;
163-
} _PyASCIIObject;
163+
} PyUnstable_ASCIIObject;
164164

165165
/* Non-ASCII strings allocated through PyUnicode_New use the
166166
PyCompactUnicodeObject structure. state.compact is set, and the data
167167
immediately follow the structure. */
168168
typedef struct {
169-
_PyASCIIObject _base;
169+
PyUnstable_ASCIIObject _base;
170170
Py_ssize_t utf8_length; /* Number of bytes in utf8, excluding the
171171
* terminating \0. */
172172
char *utf8; /* UTF-8 representation (null-terminated) */
173-
} _PyCompactUnicodeObject;
173+
} PyUnstable_CompactUnicodeObject;
174174

175175
/* Object format for Unicode subclasses. */
176176
typedef struct {
177-
_PyCompactUnicodeObject _base;
177+
PyUnstable_CompactUnicodeObject _base;
178178
union {
179179
void *any;
180180
Py_UCS1 *latin1;
181181
Py_UCS2 *ucs2;
182182
Py_UCS4 *ucs4;
183183
} data; /* Canonical, smallest-form Unicode buffer */
184-
} _PyUnicodeObject;
184+
} PyUnstable_UnicodeObject;
185185

186186

187-
_Py_DEPRECATED_EXTERNALLY(3.14) typedef _PyASCIIObject PyASCIIObject;
188-
_Py_DEPRECATED_EXTERNALLY(3.14) typedef _PyCompactUnicodeObject PyCompactUnicodeObject;
189-
_Py_DEPRECATED_EXTERNALLY(3.14) typedef _PyUnicodeObject PyUnicodeObject;
187+
_Py_DEPRECATED_EXTERNALLY(3.14) typedef PyUnstable_ASCIIObject
188+
PyASCIIObject;
189+
_Py_DEPRECATED_EXTERNALLY(3.14) typedef PyUnstable_CompactUnicodeObject
190+
PyCompactUnicodeObject;
191+
_Py_DEPRECATED_EXTERNALLY(3.14) typedef PyUnstable_UnicodeObject
192+
PyUnicodeObject;
190193

191194
#define _PyASCIIObject_CAST(op) \
192195
(assert(PyUnicode_Check(op)), \
193-
_Py_CAST(_PyASCIIObject*, (op)))
196+
_Py_CAST(PyUnstable_ASCIIObject*, (op)))
194197
#define _PyCompactUnicodeObject_CAST(op) \
195198
(assert(PyUnicode_Check(op)), \
196-
_Py_CAST(_PyCompactUnicodeObject*, (op)))
199+
_Py_CAST(PyUnstable_CompactUnicodeObject*, (op)))
197200
#define _PyUnicodeObject_CAST(op) \
198201
(assert(PyUnicode_Check(op)), \
199-
_Py_CAST(_PyUnicodeObject*, (op)))
202+
_Py_CAST(PyUnstable_UnicodeObject*, (op)))
200203

201204

202205
/* --- Flexible String Representation Helper Macros (PEP 393) -------------- */

Include/internal/pycore_global_strings.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ extern "C" {
1717

1818
#define STRUCT_FOR_ASCII_STR(LITERAL) \
1919
struct { \
20-
_PyASCIIObject _ascii; \
20+
PyUnstable_ASCIIObject _ascii; \
2121
uint8_t _data[sizeof(LITERAL)]; \
2222
}
2323
#define STRUCT_FOR_STR(NAME, LITERAL) \
@@ -786,11 +786,11 @@ struct _Py_global_strings {
786786
STRUCT_FOR_ID(zdict)
787787
} identifiers;
788788
struct {
789-
_PyASCIIObject _ascii;
789+
PyUnstable_ASCIIObject _ascii;
790790
uint8_t _data[2];
791791
} ascii[128];
792792
struct {
793-
_PyCompactUnicodeObject _latin1;
793+
PyUnstable_CompactUnicodeObject _latin1;
794794
uint8_t _data[2];
795795
} latin1[128];
796796
};

0 commit comments

Comments
 (0)