Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
update __doc__ for function object
  • Loading branch information
xuantengh committed Oct 30, 2024
commit 436b2cf2853119cc2080243ef5ddd2eac03cbd8b
2 changes: 1 addition & 1 deletion Objects/funcobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ PyFunction_NewWithQualName(PyObject *code, PyObject *globals, PyObject *qualname
PyObject *consts = code_obj->co_consts;
assert(PyTuple_Check(consts));
PyObject *doc;
if (PyTuple_Size(consts) >= 1) {
if (PyTuple_Size(consts) >= 1 && code_obj->co_flags & CO_HAS_DOCSTRING) {
Comment thread
xuantengh marked this conversation as resolved.
Outdated
doc = PyTuple_GetItem(consts, 0);
if (!PyUnicode_Check(doc)) {
doc = Py_None;
Expand Down
1 change: 0 additions & 1 deletion Python/codegen.c
Original file line number Diff line number Diff line change
Expand Up @@ -783,7 +783,6 @@ _PyCodegen_Body(compiler *c, location loc, asdl_stmt_seq *stmts, bool is_interac
assert(st->kind == Expr_kind);
location loc = LOC(st->v.Expr.value);
ADDOP_LOAD_CONST(c, loc, cleandoc);

Py_DECREF(cleandoc);
RETURN_IF_ERROR(codegen_nameop(c, NO_LOCATION, &_Py_ID(__doc__), Store));
}
Expand Down