[Python-checkins] Add a missed PyErr_NoMemory() in symtable_new(). (GH-10576)

Miss Islington (bot) webhook-mailer at python.org
Fri Nov 16 11:32:00 EST 2018


https://github.com/python/cpython/commit/0124040aef793b66c33e518c6e9c17129bee0de4
commit: 0124040aef793b66c33e518c6e9c17129bee0de4
branch: 3.6
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: GitHub <noreply at github.com>
date: 2018-11-16T08:31:57-08:00
summary:

Add a missed PyErr_NoMemory() in symtable_new(). (GH-10576)


This missed PyErr_NoMemory() could cause a SystemError when calling
_symtable.symtable().
(cherry picked from commit ad65f15581173542f1d2a9968a63bee272510ce3)

Co-authored-by: Zackery Spytz <zspytz at gmail.com>

files:
M Python/symtable.c

diff --git a/Python/symtable.c b/Python/symtable.c
index 90b07efa0334..aef845b59698 100644
--- a/Python/symtable.c
+++ b/Python/symtable.c
@@ -206,8 +206,10 @@ symtable_new(void)
     struct symtable *st;
 
     st = (struct symtable *)PyMem_Malloc(sizeof(struct symtable));
-    if (st == NULL)
+    if (st == NULL) {
+        PyErr_NoMemory();
         return NULL;
+    }
 
     st->st_filename = NULL;
     st->st_blocks = NULL;



More information about the Python-checkins mailing list