summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
Diffstat (limited to 'Python')
-rw-r--r--Python/_warnings.c4
-rw-r--r--Python/ast_opt.c2
-rw-r--r--Python/compile.c7
-rw-r--r--Python/pythonrun.c2
4 files changed, 13 insertions, 2 deletions
diff --git a/Python/_warnings.c b/Python/_warnings.c
index a47e5fe..03e6ffc 100644
--- a/Python/_warnings.c
+++ b/Python/_warnings.c
@@ -186,8 +186,8 @@ check_matched(PyInterpreterState *interp, PyObject *obj, PyObject *arg)
return rc;
}
-#define GET_WARNINGS_ATTR(interp, attr, try_import) \
- get_warnings_attr(interp, &_Py_ID(attr), try_import)
+#define GET_WARNINGS_ATTR(interp, ATTR, try_import) \
+ get_warnings_attr(interp, &_Py_ID(ATTR), try_import)
/*
Returns a new reference.
diff --git a/Python/ast_opt.c b/Python/ast_opt.c
index 2911370..77ed29d 100644
--- a/Python/ast_opt.c
+++ b/Python/ast_opt.c
@@ -268,6 +268,8 @@ parse_literal(PyObject *fmt, Py_ssize_t *ppos, PyArena *arena)
PyObject *str = PyUnicode_Substring(fmt, start, pos);
/* str = str.replace('%%', '%') */
if (str && has_percents) {
+ _Py_DECLARE_STR(percent, "%");
+ _Py_DECLARE_STR(dbl_percent, "%%");
Py_SETREF(str, PyUnicode_Replace(str, &_Py_STR(dbl_percent),
&_Py_STR(percent), -1));
}
diff --git a/Python/compile.c b/Python/compile.c
index ac4960b..1cf20d3 100644
--- a/Python/compile.c
+++ b/Python/compile.c
@@ -667,6 +667,7 @@ compiler_set_qualname(struct compiler *c)
|| parent->u_scope_type == COMPILER_SCOPE_ASYNC_FUNCTION
|| parent->u_scope_type == COMPILER_SCOPE_LAMBDA)
{
+ _Py_DECLARE_STR(dot_locals, ".<locals>");
base = PyUnicode_Concat(parent->u_qualname,
&_Py_STR(dot_locals));
if (base == NULL)
@@ -2022,6 +2023,7 @@ compiler_mod(struct compiler *c, mod_ty mod)
{
PyCodeObject *co;
int addNone = 1;
+ _Py_DECLARE_STR(anon_module, "<module>");
if (!compiler_enter_scope(c, &_Py_STR(anon_module), COMPILER_SCOPE_MODULE,
mod, 1)) {
return NULL;
@@ -2876,6 +2878,7 @@ compiler_lambda(struct compiler *c, expr_ty e)
return 0;
}
+ _Py_DECLARE_STR(anon_lambda, "<lambda>");
if (!compiler_enter_scope(c, &_Py_STR(anon_lambda), COMPILER_SCOPE_LAMBDA,
(void *)e, e->lineno)) {
return 0;
@@ -5347,6 +5350,7 @@ static int
compiler_genexp(struct compiler *c, expr_ty e)
{
assert(e->kind == GeneratorExp_kind);
+ _Py_DECLARE_STR(anon_genexpr, "<genexpr>");
return compiler_comprehension(c, e, COMP_GENEXP, &_Py_STR(anon_genexpr),
e->v.GeneratorExp.generators,
e->v.GeneratorExp.elt, NULL);
@@ -5356,6 +5360,7 @@ static int
compiler_listcomp(struct compiler *c, expr_ty e)
{
assert(e->kind == ListComp_kind);
+ _Py_DECLARE_STR(anon_listcomp, "<listcomp>");
return compiler_comprehension(c, e, COMP_LISTCOMP, &_Py_STR(anon_listcomp),
e->v.ListComp.generators,
e->v.ListComp.elt, NULL);
@@ -5365,6 +5370,7 @@ static int
compiler_setcomp(struct compiler *c, expr_ty e)
{
assert(e->kind == SetComp_kind);
+ _Py_DECLARE_STR(anon_setcomp, "<setcomp>");
return compiler_comprehension(c, e, COMP_SETCOMP, &_Py_STR(anon_setcomp),
e->v.SetComp.generators,
e->v.SetComp.elt, NULL);
@@ -5375,6 +5381,7 @@ static int
compiler_dictcomp(struct compiler *c, expr_ty e)
{
assert(e->kind == DictComp_kind);
+ _Py_DECLARE_STR(anon_dictcomp, "<dictcomp>");
return compiler_comprehension(c, e, COMP_DICTCOMP, &_Py_STR(anon_dictcomp),
e->v.DictComp.generators,
e->v.DictComp.key, e->v.DictComp.value);
diff --git a/Python/pythonrun.c b/Python/pythonrun.c
index b34a223..38ca952 100644
--- a/Python/pythonrun.c
+++ b/Python/pythonrun.c
@@ -515,6 +515,7 @@ parse_syntax_error(PyObject *err, PyObject **message, PyObject **filename,
goto finally;
if (v == Py_None) {
Py_DECREF(v);
+ _Py_DECLARE_STR(anon_string, "<string>");
*filename = &_Py_STR(anon_string);
Py_INCREF(*filename);
}
@@ -1562,6 +1563,7 @@ PyRun_StringFlags(const char *str, int start, PyObject *globals,
if (arena == NULL)
return NULL;
+ _Py_DECLARE_STR(anon_string, "<string>");
mod = _PyParser_ASTFromString(
str, &_Py_STR(anon_string), start, flags, arena);