comparison Python/Python-ast.c @ 46227:b2d93a960b98

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. ........
author Neal Norwitz <nnorwitz@gmail.com>
date Mon, 31 Mar 2008 04:20:05 +0000
parents a7fb4d87cbde
children 07b36d2b7534
comparison
equal deleted inserted replaced
46226:e9032f5dd539 46227:b2d93a960b98
6413 { 6413 {
6414 init_types(); 6414 init_types();
6415 return ast2obj_mod(t); 6415 return ast2obj_mod(t);
6416 } 6416 }
6417 6417
6418 mod_ty PyAST_obj2mod(PyObject* ast, PyArena* arena) 6418 /* mode is 0 for "exec", 1 for "eval" and 2 for "single" input */
6419 mod_ty PyAST_obj2mod(PyObject* ast, PyArena* arena, int mode)
6419 { 6420 {
6420 mod_ty res; 6421 mod_ty res;
6422 PyObject *req_type[] = {(PyObject*)Module_type, (PyObject*)Expression_type,
6423 (PyObject*)Interactive_type};
6424 char *req_name[] = {"Module", "Expression", "Interactive"};
6425 assert(0 <= mode && mode <= 2);
6426
6421 init_types(); 6427 init_types();
6422 if (!PyObject_IsInstance(ast, (PyObject*)mod_type)) { 6428
6423 PyErr_SetString(PyExc_TypeError, "expected either Module, Interactive " 6429 if (!PyObject_IsInstance(ast, req_type[mode])) {
6424 "or Expression node"); 6430 PyErr_Format(PyExc_TypeError, "expected %s node, got %.400s",
6431 req_name[mode], Py_TYPE(ast)->tp_name);
6425 return NULL; 6432 return NULL;
6426 } 6433 }
6427 if (obj2ast_mod(ast, &res, arena) != 0) 6434 if (obj2ast_mod(ast, &res, arena) != 0)
6428 return NULL; 6435 return NULL;
6429 else 6436 else