]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Correct micro release number and add a couple of asserts. (GH-25224)
authorMark Shannon <mark@hotpy.org>
Wed, 7 Apr 2021 09:52:07 +0000 (10:52 +0100)
committerGitHub <noreply@github.com>
Wed, 7 Apr 2021 09:52:07 +0000 (10:52 +0100)
Lib/importlib/_bootstrap_external.py
Python/compile.c

index 0b6cc8a8e32141509c98c983f4fd4568f56fdc54..66ba7dceedc8b2d98e40b446e516293332f1c3b2 100644 (file)
@@ -348,7 +348,7 @@ _code_type = type(_write_atomic.__code__)
 #     Python 3.10a2 3433 (RERAISE restores f_lasti if oparg != 0)
 #     Python 3.10a6 3434 (PEP 634: Structural Pattern Matching)
 #     Python 3.10a7 3435 Use instruction offsets (as opposed to byte offsets).
-#     Python 3.10a7 3436 (Add GEN_START bytecode #43683)
+#     Python 3.10b1 3436 (Add GEN_START bytecode #43683)
 
 #
 # MAGIC must change whenever the bytecode emitted by the compiler may no
index c2fa1c02821916d4fdd5203937929a92ad9153ff..65dacc2da64bd634e9a973d42c6c6e8d0a96b45e 100644 (file)
@@ -6162,8 +6162,7 @@ stackdepth(struct compiler *c)
         entryblock = b;
         nblocks++;
     }
-    if (!entryblock)
-        return 0;
+    assert(entryblock!= NULL);
     stack = (basicblock **)PyObject_Malloc(sizeof(basicblock *) * nblocks);
     if (!stack) {
         PyErr_NoMemory();
@@ -6725,6 +6724,7 @@ assemble(struct compiler *c, int addNone)
         nblocks++;
         entryblock = b;
     }
+    assert(entryblock != NULL);
 
     if (insert_generator_prefix(c, entryblock)) {
         goto error;
@@ -6732,7 +6732,7 @@ assemble(struct compiler *c, int addNone)
 
     /* Set firstlineno if it wasn't explicitly set. */
     if (!c->u->u_firstlineno) {
-        if (entryblock && entryblock->b_instr && entryblock->b_instr->i_lineno)
+        if (entryblock->b_instr && entryblock->b_instr->i_lineno)
             c->u->u_firstlineno = entryblock->b_instr->i_lineno;
        else
             c->u->u_firstlineno = 1;