mirror of
https://github.com/python/cpython.git
synced 2025-11-26 13:22:51 +00:00
gh-81057: Move the Cached Parser Dummy Name to _PyRuntimeState (#100277)
This commit is contained in:
parent
5ee7eb9deb
commit
0415cf895f
4 changed files with 20 additions and 25 deletions
|
|
@ -9,6 +9,8 @@ extern "C" {
|
|||
#endif
|
||||
|
||||
|
||||
#include "pycore_ast.h" // struct _expr
|
||||
#include "pycore_global_strings.h" // _Py_DECLARE_STR()
|
||||
#include "pycore_pyarena.h" // PyArena
|
||||
|
||||
|
||||
|
|
@ -22,9 +24,22 @@ struct _parser_runtime_state {
|
|||
#else
|
||||
int _not_used;
|
||||
#endif
|
||||
struct _expr dummy_name;
|
||||
};
|
||||
|
||||
|
||||
_Py_DECLARE_STR(empty, "")
|
||||
#define _parser_runtime_state_INIT \
|
||||
{ \
|
||||
.dummy_name = { \
|
||||
.kind = Name_kind, \
|
||||
.v.Name.id = &_Py_STR(empty), \
|
||||
.v.Name.ctx = Load, \
|
||||
.lineno = 1, \
|
||||
.col_offset = 0, \
|
||||
.end_lineno = 1, \
|
||||
.end_col_offset = 0, \
|
||||
}, \
|
||||
}
|
||||
|
||||
extern struct _mod* _PyParser_ASTFromString(
|
||||
const char *str,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue