Skip to content

Commit dee574e

Browse files
Get rid of _Py_static_string() in compile.c.
1 parent 9901e82 commit dee574e

File tree

1 file changed

+4
-11
lines changed

1 file changed

+4
-11
lines changed

Python/compile.c

+4-11
Original file line numberDiff line numberDiff line change
@@ -633,8 +633,6 @@ compiler_unit_free(struct compiler_unit *u)
633633
static int
634634
compiler_set_qualname(struct compiler *c)
635635
{
636-
_Py_static_string(dot, ".");
637-
_Py_static_string(dot_locals, ".<locals>");
638636
Py_ssize_t stack_size;
639637
struct compiler_unit *u = c->u;
640638
PyObject *name, *base, *dot_str, *dot_locals_str;
@@ -668,10 +666,9 @@ compiler_set_qualname(struct compiler *c)
668666
if (!force_global) {
669667
if (parent->u_scope_type == COMPILER_SCOPE_FUNCTION
670668
|| parent->u_scope_type == COMPILER_SCOPE_ASYNC_FUNCTION
671-
|| parent->u_scope_type == COMPILER_SCOPE_LAMBDA) {
672-
dot_locals_str = _PyUnicode_FromId(&dot_locals);
673-
if (dot_locals_str == NULL)
674-
return 0;
669+
|| parent->u_scope_type == COMPILER_SCOPE_LAMBDA)
670+
{
671+
dot_locals_str = _Py_GET_GLOBAL_STRING(dot_locals);
675672
base = PyUnicode_Concat(parent->u_qualname, dot_locals_str);
676673
if (base == NULL)
677674
return 0;
@@ -684,11 +681,7 @@ compiler_set_qualname(struct compiler *c)
684681
}
685682

686683
if (base != NULL) {
687-
dot_str = _PyUnicode_FromId(&dot);
688-
if (dot_str == NULL) {
689-
Py_DECREF(base);
690-
return 0;
691-
}
684+
dot_str = _Py_GET_GLOBAL_STRING(dot);
692685
name = PyUnicode_Concat(base, dot_str);
693686
Py_DECREF(base);
694687
if (name == NULL)

0 commit comments

Comments
 (0)