Feature or enhancement
Proposal:
In static int codegen_function_body(compiler *c, stmt_ty s, int is_async, Py_ssize_t funcflags, int firstlineno) we use a check whether co == NULL in
PyCodeObject *co = _PyCompile_OptimizeAndAssemble(c, 1);
_PyCompile_ExitScope(c);
if (co == NULL) {
Py_XDECREF(co);
return ERROR;
}
and then use Py_XDECREF(co); which always returns a check failure in the case co == NULL which we already checked previously and for this reason never calls Py_DECREF(co); (which would anyway not work because it would cause errors) before we return the ERROR. Because of this, that condition check (which is triggered again) is unnecessary and just decreases performance slightly.
Has this already been discussed elsewhere?
This is a minor feature, which does not need previous discussion elsewhere
Links to previous discussion of this feature:
No response
Linked PRs
Feature or enhancement
Proposal:
In
static int codegen_function_body(compiler *c, stmt_ty s, int is_async, Py_ssize_t funcflags, int firstlineno)we use a check whether co == NULL inand then use
Py_XDECREF(co);which always returns a check failure in the case co == NULL which we already checked previously and for this reason never callsPy_DECREF(co);(which would anyway not work because it would cause errors) before we return the ERROR. Because of this, that condition check (which is triggered again) is unnecessary and just decreases performance slightly.Has this already been discussed elsewhere?
This is a minor feature, which does not need previous discussion elsewhere
Links to previous discussion of this feature:
No response
Linked PRs
codegen.cthroughco == NULLandPy_XDECREF(co);#144823