Skip to content

Commit 1dc125e

Browse files
committed
add ste fetch and news
1 parent 2c7eaeb commit 1dc125e

File tree

2 files changed

+6
-10
lines changed

2 files changed

+6
-10
lines changed
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
Set ``ste_has_docstring`` for ``class`` and ``module`` in corresponding
2-
symbol table entry.
1+
Following :gh:`126101`, for :ref:`codeobjects` like lambda, annotation and type alias,
2+
we no longer add ``None`` to its :attr:`~codeobject.co_consts`.

Python/symtable.c

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -435,10 +435,8 @@ _PySymtable_Build(mod_ty mod, PyObject *filename, _PyFutureFeatures *future)
435435
case Module_kind:
436436
seq = mod->v.Module.body;
437437
if (_PyAST_GetDocString(seq)) {
438-
PySTEntryObject *mod_ste = _PySymtable_Lookup(st, mod);
439-
assert(mod_ste);
440-
mod_ste->ste_has_docstring = 1;
441-
Py_DECREF(mod_ste);
438+
assert(st->st_cur);
439+
st->st_cur->ste_has_docstring = 1;
442440
}
443441
for (i = 0; i < asdl_seq_LEN(seq); i++)
444442
if (!symtable_visit_stmt(st,
@@ -1917,10 +1915,8 @@ symtable_visit_stmt(struct symtable *st, stmt_ty s)
19171915
}
19181916

19191917
if (_PyAST_GetDocString(s->v.ClassDef.body)) {
1920-
PySTEntryObject *class_ste = _PySymtable_Lookup(st, s);
1921-
assert(class_ste);
1922-
class_ste->ste_has_docstring = 1;
1923-
Py_DECREF(class_ste);
1918+
assert(st->st_cur);
1919+
st->st_cur->ste_has_docstring = 1;
19241920
}
19251921

19261922
VISIT_SEQ(st, stmt, s->v.ClassDef.body);

0 commit comments

Comments
 (0)