GH-94851: check unicode consistency of static strings in debug mode (#102684)

This commit is contained in:
Kumar Aditya 2023-03-14 15:21:38 +05:30 committed by GitHub
parent 88c262c086
commit a703f743db
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 665 additions and 0 deletions

File diff suppressed because it is too large Load Diff

View File

@ -360,6 +360,7 @@ def generate_static_strings_initializer(identifiers, strings):
# This use of _Py_ID() is ignored by iter_global_strings()
# since iter_files() ignores .h files.
printer.write(f'string = &_Py_ID({i});')
printer.write(f'assert(_PyUnicode_CheckConsistency(string, 1));')
printer.write(f'PyUnicode_InternInPlace(&string);')
# XXX What about "strings"?
printer.write(END)