GH-96458: Statically initialize utf8 representation of static strings (#96481)

This commit is contained in:
Kumar Aditya 2022-09-03 12:13:08 +05:30 committed by GitHub
parent 16c6759b37
commit 6dab8c95bd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 139 additions and 165 deletions

View file

@ -113,10 +113,12 @@ extern "C" {
._ ## NAME = _PyASCIIObject_INIT(LITERAL)
#define INIT_ID(NAME) \
._ ## NAME = _PyASCIIObject_INIT(#NAME)
#define _PyUnicode_LATIN1_INIT(LITERAL) \
#define _PyUnicode_LATIN1_INIT(LITERAL, UTF8) \
{ \
._latin1 = { \
._base = _PyUnicode_ASCII_BASE_INIT((LITERAL), 0), \
.utf8 = (UTF8), \
.utf8_length = sizeof(UTF8) - 1, \
}, \
._data = (LITERAL), \
}