@@ -189,6 +189,8 @@ NOTE: In the interpreter's initialization phase, some globals are currently
189
189
# define OVERALLOCATE_FACTOR 4
190
190
#endif
191
191
192
+ #define EMBED_NULL_UNKNOWN 2
193
+
192
194
/* Forward declaration */
193
195
static inline int
194
196
_PyUnicodeWriter_WriteCharInline (_PyUnicodeWriter * writer , Py_UCS4 ch );
@@ -628,7 +630,7 @@ _PyUnicode_CheckConsistency(PyObject *op, int check_content)
628
630
CHECK (PyUnicode_READ (kind , data , ascii -> length ) == 0 );
629
631
}
630
632
631
- if (_PyUnicode_STATE (ascii ).embed_null != 2 ) {
633
+ if (_PyUnicode_STATE (ascii ).embed_null != EMBED_NULL_UNKNOWN ) {
632
634
Py_ssize_t pos = findchar (PyUnicode_DATA (ascii ),
633
635
PyUnicode_KIND (ascii ),
634
636
PyUnicode_GET_LENGTH (ascii ),
@@ -1266,7 +1268,7 @@ PyUnicode_New(Py_ssize_t size, Py_UCS4 maxchar)
1266
1268
_PyUnicode_STATE (unicode ).compact = 1 ;
1267
1269
_PyUnicode_STATE (unicode ).ascii = is_ascii ;
1268
1270
_PyUnicode_STATE (unicode ).statically_allocated = 0 ;
1269
- _PyUnicode_STATE (unicode ).embed_null = 2 ;
1271
+ _PyUnicode_STATE (unicode ).embed_null = EMBED_NULL_UNKNOWN ;
1270
1272
if (is_ascii ) {
1271
1273
((char * )data )[size ] = 0 ;
1272
1274
}
@@ -3876,7 +3878,7 @@ PyUnicode_AsUTF8(PyObject *unicode)
3876
3878
3877
3879
// Cache to avoid calling O(n) strlen() operation at every
3878
3880
// PyUnicode_AsUTF8() call on the same object.
3879
- if (_PyUnicode_STATE (unicode ).embed_null == 2 ) {
3881
+ if (_PyUnicode_STATE (unicode ).embed_null == EMBED_NULL_UNKNOWN ) {
3880
3882
if (strlen (utf8 ) != (size_t )size ) {
3881
3883
_PyUnicode_STATE (unicode ).embed_null = 1 ;
3882
3884
}
@@ -14668,7 +14670,7 @@ unicode_subtype_new(PyTypeObject *type, PyObject *unicode)
14668
14670
_PyUnicode_STATE (self ).compact = 0 ;
14669
14671
_PyUnicode_STATE (self ).ascii = _PyUnicode_STATE (unicode ).ascii ;
14670
14672
_PyUnicode_STATE (self ).statically_allocated = 0 ;
14671
- _PyUnicode_STATE (self ).embed_null = 2 ;
14673
+ _PyUnicode_STATE (self ).embed_null = EMBED_NULL_UNKNOWN ;
14672
14674
_PyUnicode_UTF8_LENGTH (self ) = 0 ;
14673
14675
_PyUnicode_UTF8 (self ) = NULL ;
14674
14676
_PyUnicode_DATA_ANY (self ) = NULL ;
0 commit comments