diff options
author | Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com> | 2022-11-09 16:53:21 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-09 16:53:21 (GMT) |
commit | 6e3cc72afeaee2532b4327776501eb8234ac787b (patch) | |
tree | a951ff89cfdec4cc449dd92a7e36372abd103f78 /Programs | |
parent | c03e05c2e72f3ea5e797389e7d1042eef85ad37a (diff) | |
download | cpython-6e3cc72afeaee2532b4327776501eb8234ac787b.zip cpython-6e3cc72afeaee2532b4327776501eb8234ac787b.tar.gz cpython-6e3cc72afeaee2532b4327776501eb8234ac787b.tar.bz2 |
GH-90699: disallow `_Py_IDENTIFIER` in core code (GH-99210)
Diffstat (limited to 'Programs')
-rw-r--r-- | Programs/_testembed.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/Programs/_testembed.c b/Programs/_testembed.c index adb4483..a6ce3f7 100644 --- a/Programs/_testembed.c +++ b/Programs/_testembed.c @@ -1,7 +1,6 @@ #ifndef Py_BUILD_CORE_MODULE # define Py_BUILD_CORE_MODULE #endif -#define NEEDS_PY_IDENTIFIER /* Always enable assertion (even in release mode) */ #undef NDEBUG @@ -1891,7 +1890,14 @@ static int test_unicode_id_init(void) { // bpo-42882: Test that _PyUnicode_FromId() works // when Python is initialized multiples times. - _Py_IDENTIFIER(test_unicode_id_init); + + // This is equivalent to `_Py_IDENTIFIER(test_unicode_id_init)` + // but since `_Py_IDENTIFIER` is disabled when `Py_BUILD_CORE` + // is defined, it is manually expanded here. + static _Py_Identifier PyId_test_unicode_id_init = { + .string = "test_unicode_id_init", + .index = -1, + }; // Initialize Python once without using the identifier _testembed_Py_InitializeFromConfig(); |