mirror of
https://github.com/python/cpython.git
synced 2025-08-24 02:35:59 +00:00
gh-126072: do not add None
to co_consts
if there is no docstring (GH-126101)
This commit is contained in:
parent
2ab377a47c
commit
35df4eb959
16 changed files with 148 additions and 58 deletions
|
@ -1243,10 +1243,10 @@ codegen_function_body(compiler *c, stmt_ty s, int is_async, Py_ssize_t funcflags
|
|||
_PyCompile_ExitScope(c);
|
||||
return ERROR;
|
||||
}
|
||||
Py_ssize_t idx = _PyCompile_AddConst(c, docstring);
|
||||
Py_DECREF(docstring);
|
||||
RETURN_IF_ERROR_IN_SCOPE(c, idx < 0 ? ERROR : SUCCESS);
|
||||
}
|
||||
Py_ssize_t idx = _PyCompile_AddConst(c, docstring ? docstring : Py_None);
|
||||
Py_XDECREF(docstring);
|
||||
RETURN_IF_ERROR_IN_SCOPE(c, idx < 0 ? ERROR : SUCCESS);
|
||||
|
||||
NEW_JUMP_TARGET_LABEL(c, start);
|
||||
USE_LABEL(c, start);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue