Skip to content

Commit c858b98

Browse files
committed
Shorten names and comments of the generator call helpers
1 parent a8eb697 commit c858b98

2 files changed

Lines changed: 5 additions & 17 deletions

File tree

‎Python/ceval.c‎

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2119,17 +2119,8 @@ _PyEvalFramePushAndInit(PyThreadState *tstate, _PyStackRef func,
21192119
return NULL;
21202120
}
21212121

2122-
/* Create the generator, coroutine or async generator object for a call of
2123-
'func' directly, without pushing a frame and executing RETURN_GENERATOR.
2124-
The code object must start with RETURN_GENERATOR. The new object's
2125-
frame is left at the next instruction, exactly as RETURN_GENERATOR
2126-
would leave it.
2127-
'argcount' counts the positional arguments; the values of the keyword
2128-
arguments named by 'kwnames' (which may be NULL) follow them in 'args'.
2129-
If 'exact_args' is true, 'kwnames' must be NULL, 'argcount' must equal
2130-
co_argcount and the function must have no *args, **kwargs or keyword-only
2131-
parameters.
2132-
Consumes references to func and all the args, but not to kwnames. */
2122+
/* Create the generator object for a call of 'func', as RETURN_GENERATOR
2123+
would, without pushing a frame. Steals func and args, not kwnames. */
21332124
PyObject *
21342125
_PyEval_MakeGenStackRefSteal(PyThreadState *tstate, _PyStackRef func,
21352126
_PyStackRef *args, int argcount,

‎Python/specialize.c‎

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1751,11 +1751,8 @@ specialize_method_descriptor(PyMethodDescrObject *descr, PyObject *self_or_null,
17511751
return 0;
17521752
}
17531753

1754-
/* Is 'code' a generator, coroutine or async generator function whose body
1755-
starts with RETURN_GENERATOR, so that calling it can create the generator
1756-
object directly? */
17571754
static bool
1758-
is_simple_generator(PyCodeObject *code)
1755+
is_simple_gen(PyCodeObject *code)
17591756
{
17601757
int flags = code->co_flags & (CO_GENERATOR | CO_COROUTINE | CO_ASYNC_GENERATOR);
17611758
return flags != 0 &&
@@ -1794,7 +1791,7 @@ specialize_py_call(PyFunctionObject *func, _Py_CODEUNIT *instr, int nargs,
17941791
write_u32(cache->func_version, version);
17951792
uint8_t opcode;
17961793
bool exact_args = (argcount == nargs + bound_method);
1797-
if (is_simple_generator(code)) {
1794+
if (is_simple_gen(code)) {
17981795
if (exact_args) {
17991796
opcode = bound_method ? CALL_BOUND_METHOD_GEN_EXACT_ARGS
18001797
: CALL_PY_GEN_EXACT_ARGS;
@@ -1842,7 +1839,7 @@ specialize_py_call_kw(PyFunctionObject *func, _Py_CODEUNIT *instr, int nargs,
18421839
return -1;
18431840
}
18441841
write_u32(cache->func_version, version);
1845-
if (is_simple_generator(code)) {
1842+
if (is_simple_gen(code)) {
18461843
specialize(instr, bound_method ? CALL_KW_BOUND_METHOD_GEN
18471844
: CALL_KW_PY_GEN);
18481845
}

0 commit comments

Comments
 (0)