diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2013-07-17 00:17:15 +0200 |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2013-07-17 00:17:15 +0200 |
commit | 4a24ef255230351821289b34f0bc4fdd546f86ea (patch) | |
tree | b62f47f450c5b6feb89e8df7d9b1b787528c131b /Python/Python-ast.c | |
parent | 93e28c82ffb771da85e3d9a37ae970abf3bfbc2e (diff) | |
download | cpython-4a24ef255230351821289b34f0bc4fdd546f86ea.tar.gz |
Issue #18408: Fix Python-ast.c: handle init_types() failure (ex: MemoryError)
Diffstat (limited to 'Python/Python-ast.c')
-rw-r--r-- | Python/Python-ast.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/Python/Python-ast.c b/Python/Python-ast.c index 744e640bce..71420c5e1e 100644 --- a/Python/Python-ast.c +++ b/Python/Python-ast.c @@ -7188,7 +7188,8 @@ PyInit__ast(void) PyObject* PyAST_mod2obj(mod_ty t) { - init_types(); + if (!init_types()) + return NULL; return ast2obj_mod(t); } @@ -7202,7 +7203,8 @@ mod_ty PyAST_obj2mod(PyObject* ast, PyArena* arena, int mode) int isinstance; assert(0 <= mode && mode <= 2); - init_types(); + if (!init_types()) + return NULL; isinstance = PyObject_IsInstance(ast, req_type[mode]); if (isinstance == -1) @@ -7220,7 +7222,8 @@ mod_ty PyAST_obj2mod(PyObject* ast, PyArena* arena, int mode) int PyAST_Check(PyObject* obj) { - init_types(); + if (!init_types()) + return -1; return PyObject_IsInstance(obj, (PyObject*)&AST_type); } |