Commit 6e3cc72 1 parent c03e05c commit 6e3cc72 Copy full SHA for 6e3cc72
File tree 2 files changed +10
-4
lines changed
2 files changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -41,15 +41,15 @@ typedef struct _Py_Identifier {
41
41
Py_ssize_t index ;
42
42
} _Py_Identifier ;
43
43
44
- #if defined( NEEDS_PY_IDENTIFIER ) || !defined( Py_BUILD_CORE )
44
+ #ifndef Py_BUILD_CORE
45
45
// For now we are keeping _Py_IDENTIFIER for continued use
46
46
// in non-builtin extensions (and naughty PyPI modules).
47
47
48
48
#define _Py_static_string_init (value ) { .string = (value), .index = -1 }
49
49
#define _Py_static_string (varname , value ) static _Py_Identifier varname = _Py_static_string_init(value)
50
50
#define _Py_IDENTIFIER (varname ) _Py_static_string(PyId_##varname, #varname)
51
51
52
- #endif /* NEEDS_PY_IDENTIFIER */
52
+ #endif /* !Py_BUILD_CORE */
53
53
54
54
typedef struct {
55
55
/* Number implementations must check *both*
Original file line number Diff line number Diff line change 1
1
#ifndef Py_BUILD_CORE_MODULE
2
2
# define Py_BUILD_CORE_MODULE
3
3
#endif
4
- #define NEEDS_PY_IDENTIFIER
5
4
6
5
/* Always enable assertion (even in release mode) */
7
6
#undef NDEBUG
@@ -1891,7 +1890,14 @@ static int test_unicode_id_init(void)
1891
1890
{
1892
1891
// bpo-42882: Test that _PyUnicode_FromId() works
1893
1892
// when Python is initialized multiples times.
1894
- _Py_IDENTIFIER (test_unicode_id_init );
1893
+
1894
+ // This is equivalent to `_Py_IDENTIFIER(test_unicode_id_init)`
1895
+ // but since `_Py_IDENTIFIER` is disabled when `Py_BUILD_CORE`
1896
+ // is defined, it is manually expanded here.
1897
+ static _Py_Identifier PyId_test_unicode_id_init = {
1898
+ .string = "test_unicode_id_init" ,
1899
+ .index = -1 ,
1900
+ };
1895
1901
1896
1902
// Initialize Python once without using the identifier
1897
1903
_testembed_Py_InitializeFromConfig ();
You can’t perform that action at this time.
0 commit comments