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
8a4b42b7
Commit
8a4b42b7
authored
Jul 22, 2011
by
Benjamin Peterson
Browse files
Options
Browse Files
Download
Plain Diff
merge 3.2
parents
51a6b371
180e6350
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
20 deletions
+16
-20
Parser/asdl_c.py
Parser/asdl_c.py
+8
-10
Python/Python-ast.c
Python/Python-ast.c
+8
-10
No files found.
Parser/asdl_c.py
View file @
8a4b42b7
...
...
@@ -795,24 +795,22 @@ static int obj2ast_object(PyObject* obj, PyObject** out, PyArena* arena)
return 0;
}
static int obj2ast_stringlike(PyObject* obj, PyObject** out, PyArena* arena,
const char *name)
static int obj2ast_identifier(PyObject* obj, PyObject** out, PyArena* arena)
{
if (!PyUnicode_CheckExact(
name)
) {
PyErr_
Format(PyExc_TypeError, "AST %s must be of type str", name
);
if (!PyUnicode_CheckExact(
obj) && obj != Py_None
) {
PyErr_
SetString(PyExc_TypeError, "AST identifier must be of type str"
);
return 1;
}
return obj2ast_object(obj, out, arena);
}
static int obj2ast_identifier(PyObject* obj, PyObject** out, PyArena* arena)
{
return obj2ast_stringlike(obj, out, arena, "identifier");
}
static int obj2ast_string(PyObject* obj, PyObject** out, PyArena* arena)
{
return obj2ast_stringlike(obj, out, arena, "string");
if (!PyUnicode_CheckExact(obj)) {
PyErr_SetString(PyExc_TypeError, "AST string must be of type str");
return 1;
}
return obj2ast_object(obj, out, arena);
}
static int obj2ast_int(PyObject* obj, int* out, PyArena* arena)
...
...
Python/Python-ast.c
View file @
8a4b42b7
...
...
@@ -592,24 +592,22 @@ static int obj2ast_object(PyObject* obj, PyObject** out, PyArena* arena)
return
0
;
}
static
int
obj2ast_stringlike
(
PyObject
*
obj
,
PyObject
**
out
,
PyArena
*
arena
,
const
char
*
name
)
static
int
obj2ast_identifier
(
PyObject
*
obj
,
PyObject
**
out
,
PyArena
*
arena
)
{
if
(
!
PyUnicode_CheckExact
(
name
)
)
{
PyErr_
Format
(
PyExc_TypeError
,
"AST %s must be of type str"
,
name
);
if
(
!
PyUnicode_CheckExact
(
obj
)
&&
obj
!=
Py_None
)
{
PyErr_
SetString
(
PyExc_TypeError
,
"AST identifier must be of type str"
);
return
1
;
}
return
obj2ast_object
(
obj
,
out
,
arena
);
}
static
int
obj2ast_identifier
(
PyObject
*
obj
,
PyObject
**
out
,
PyArena
*
arena
)
{
return
obj2ast_stringlike
(
obj
,
out
,
arena
,
"identifier"
);
}
static
int
obj2ast_string
(
PyObject
*
obj
,
PyObject
**
out
,
PyArena
*
arena
)
{
return
obj2ast_stringlike
(
obj
,
out
,
arena
,
"string"
);
if
(
!
PyUnicode_CheckExact
(
obj
))
{
PyErr_SetString
(
PyExc_TypeError
,
"AST string must be of type str"
);
return
1
;
}
return
obj2ast_object
(
obj
,
out
,
arena
);
}
static
int
obj2ast_int
(
PyObject
*
obj
,
int
*
out
,
PyArena
*
arena
)
...
...
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