Skip to content

Commit 507d8bc

Browse files
authored
gh-106149: fix comment on stackdepth of generators (#107321)
1 parent 2ad6990 commit 507d8bc

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

Python/compile.c

+3-2
Original file line numberDiff line numberDiff line change
@@ -7735,8 +7735,9 @@ optimize_and_assemble_code_unit(struct compiler_unit *u, PyObject *const_cache,
77357735
/* prepare_localsplus adds instructions for generators that push
77367736
* and pop an item on the stack. This assertion makes sure there
77377737
* is space on the stack for that.
7738-
* It should always be true, because at least one expression is
7739-
* required to turn a function into a generator.
7738+
* It should always be true, because a generator must have at
7739+
* least one expression or call to INTRINSIC_STOPITERATION_ERROR,
7740+
* which requires stackspace.
77407741
*/
77417742
assert(!(IS_GENERATOR(code_flags) && stackdepth == 0));
77427743

0 commit comments

Comments
 (0)