Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
bdf630c4
Commit
bdf630c4
authored
Jul 17, 2013
by
Victor Stinner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #18408: Fix Python-ast.c: handle init_types() failure (ex: MemoryError)
parent
6684bdf7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
6 deletions
+12
-6
Parser/asdl_c.py
Parser/asdl_c.py
+6
-3
Python/Python-ast.c
Python/Python-ast.c
+6
-3
No files found.
Parser/asdl_c.py
View file @
bdf630c4
...
...
@@ -1191,7 +1191,8 @@ class PartingShots(StaticVisitor):
CODE
=
"""
PyObject* PyAST_mod2obj(mod_ty t)
{
init_types();
if (!init_types())
return NULL;
return ast2obj_mod(t);
}
...
...
@@ -1205,7 +1206,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)
...
...
@@ -1223,7 +1225,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);
}
"""
...
...
Python/Python-ast.c
View file @
bdf630c4
...
...
@@ -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
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment