diff options
author | Neal Norwitz <nnorwitz@gmail.com> | 2008-03-31 04:20:05 (GMT) |
---|---|---|
committer | Neal Norwitz <nnorwitz@gmail.com> | 2008-03-31 04:20:05 (GMT) |
commit | db4115ffc063f20da2c6078bb93187ee8753d4ec (patch) | |
tree | aefc108acfa75b71a627cb7fa3c0cfd6428a8e07 /Python/Python-ast.c | |
parent | 9367c78c84efaa3f2d6797ca7e18dc78e838c531 (diff) | |
download | cpython-db4115ffc063f20da2c6078bb93187ee8753d4ec.zip cpython-db4115ffc063f20da2c6078bb93187ee8753d4ec.tar.gz cpython-db4115ffc063f20da2c6078bb93187ee8753d4ec.tar.bz2 |
Merged revisions 62039-62042 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r62039 | georg.brandl | 2008-03-29 06:24:23 -0700 (Sat, 29 Mar 2008) | 3 lines
Properly check for consistency with the third argument of
compile() when compiling an AST node.
........
r62040 | amaury.forgeotdarc | 2008-03-29 06:47:05 -0700 (Sat, 29 Mar 2008) | 5 lines
The buildbot "x86 W2k8 trunk" seems to hang in test_socket.
http://www.python.org/dev/buildbot/trunk/x86%20W2k8%20trunk/builds/255/step-test/0
Temporarily increase verbosity of this test.
........
r62042 | amaury.forgeotdarc | 2008-03-29 07:53:05 -0700 (Sat, 29 Mar 2008) | 3 lines
Still investigating on the hanging test_socket.
the test itself doesn't do anything on windows, focus on setUp and tearDown.
........
Diffstat (limited to 'Python/Python-ast.c')
-rw-r--r-- | Python/Python-ast.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/Python/Python-ast.c b/Python/Python-ast.c index 464d28d..9f85581 100644 --- a/Python/Python-ast.c +++ b/Python/Python-ast.c @@ -6415,13 +6415,20 @@ PyObject* PyAST_mod2obj(mod_ty t) return ast2obj_mod(t); } -mod_ty PyAST_obj2mod(PyObject* ast, PyArena* arena) +/* mode is 0 for "exec", 1 for "eval" and 2 for "single" input */ +mod_ty PyAST_obj2mod(PyObject* ast, PyArena* arena, int mode) { mod_ty res; + PyObject *req_type[] = {(PyObject*)Module_type, (PyObject*)Expression_type, + (PyObject*)Interactive_type}; + char *req_name[] = {"Module", "Expression", "Interactive"}; + assert(0 <= mode && mode <= 2); + init_types(); - if (!PyObject_IsInstance(ast, (PyObject*)mod_type)) { - PyErr_SetString(PyExc_TypeError, "expected either Module, Interactive " - "or Expression node"); + + if (!PyObject_IsInstance(ast, req_type[mode])) { + PyErr_Format(PyExc_TypeError, "expected %s node, got %.400s", + req_name[mode], Py_TYPE(ast)->tp_name); return NULL; } if (obj2ast_mod(ast, &res, arena) != 0) |