when no module is given in a 'from' relative import, make ImportFrom.module NULL

This commit is contained in:
Benjamin Peterson 2009-06-13 20:23:33 +00:00
parent 52c4bec76b
commit a72be3b325
6 changed files with 28 additions and 21 deletions

View file

@ -1330,11 +1330,6 @@ ImportFrom(identifier module, asdl_seq * names, int level, int lineno, int
col_offset, PyArena *arena)
{
stmt_ty p;
if (!module) {
PyErr_SetString(PyExc_ValueError,
"field module is required for ImportFrom");
return NULL;
}
p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));
if (!p)
return NULL;
@ -4273,8 +4268,7 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
Py_XDECREF(tmp);
tmp = NULL;
} else {
PyErr_SetString(PyExc_TypeError, "required field \"module\" missing from ImportFrom");
return 1;
module = NULL;
}
if (PyObject_HasAttrString(obj, "names")) {
int res;