[Python-checkins] Correct micro release number and add a couple of asserts. (GH-25224)

markshannon webhook-mailer at python.org
Wed Apr 7 05:52:16 EDT 2021


https://github.com/python/cpython/commit/67969f5eb80844b68005181fd887bcf94c01fb40
commit: 67969f5eb80844b68005181fd887bcf94c01fb40
branch: master
author: Mark Shannon <mark at hotpy.org>
committer: markshannon <mark at hotpy.org>
date: 2021-04-07T10:52:07+01:00
summary:

Correct micro release number and add a couple of asserts. (GH-25224)

files:
M Lib/importlib/_bootstrap_external.py
M Python/compile.c

diff --git a/Lib/importlib/_bootstrap_external.py b/Lib/importlib/_bootstrap_external.py
index 0b6cc8a8e3214..66ba7dceedc8b 100644
--- a/Lib/importlib/_bootstrap_external.py
+++ b/Lib/importlib/_bootstrap_external.py
@@ -348,7 +348,7 @@ def _write_atomic(path, data, mode=0o666):
 #     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
diff --git a/Python/compile.c b/Python/compile.c
index c2fa1c0282191..65dacc2da64bd 100644
--- a/Python/compile.c
+++ b/Python/compile.c
@@ -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;



More information about the Python-checkins mailing list