]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-106149: fix comment on stackdepth of generators (#107321)
authorIrit Katriel <1055913+iritkatriel@users.noreply.github.com>
Wed, 26 Jul 2023 22:31:47 +0000 (23:31 +0100)
committerGitHub <noreply@github.com>
Wed, 26 Jul 2023 22:31:47 +0000 (22:31 +0000)
Python/compile.c

index b4e06e7cb140851bc857092fdfc318aff461d865..b673e3ac6c1cc5264c45cc50128d6ad0476beb49 100644 (file)
@@ -7735,8 +7735,9 @@ optimize_and_assemble_code_unit(struct compiler_unit *u, PyObject *const_cache,
     /* prepare_localsplus adds instructions for generators that push
      * and pop an item on the stack. This assertion makes sure there
      * is space on the stack for that.
-     * It should always be true, because at least one expression is
-     * required to turn a function into a generator.
+     * It should always be true, because a generator must have at
+     * least one expression or call to INTRINSIC_STOPITERATION_ERROR,
+     * which requires stackspace.
      */
     assert(!(IS_GENERATOR(code_flags) && stackdepth == 0));