Author: Armin Rigo <ar...@tunes.org> Branch: Changeset: r44558:3992786f8966 Date: 2011-05-27 21:50 +0200 http://bitbucket.org/pypy/pypy/changeset/3992786f8966/
Log: merge heads diff --git a/pypy/annotation/description.py b/pypy/annotation/description.py --- a/pypy/annotation/description.py +++ b/pypy/annotation/description.py @@ -565,7 +565,7 @@ if self.is_exception_class(): if self.pyobj.__module__ == 'exceptions': return True - if self.pyobj is py.code._AssertionError: + if issubclass(self.pyobj, AssertionError): return True return False diff --git a/pypy/interpreter/astcompiler/misc.py b/pypy/interpreter/astcompiler/misc.py --- a/pypy/interpreter/astcompiler/misc.py +++ b/pypy/interpreter/astcompiler/misc.py @@ -31,11 +31,12 @@ future_lineno = 0 future_column = 0 have_docstring = False + body = None if isinstance(tree, ast.Module): body = tree.body elif isinstance(tree, ast.Interactive): body = tree.body - else: + if body is None: return 0, 0 for stmt in body: if isinstance(stmt, ast.Expr) and isinstance(stmt.value, ast.Str): diff --git a/pypy/module/_ast/test/test_ast.py b/pypy/module/_ast/test/test_ast.py --- a/pypy/module/_ast/test/test_ast.py +++ b/pypy/module/_ast/test/test_ast.py @@ -128,6 +128,9 @@ assert ns["x"] == ns["lemon"] == 3 assert ns["apple"] == 4 + def test_empty_module(self): + compile(self.ast.Module([]), "<test>", "exec") + def test_ast_types(self): ast = self.ast expr = ast.Expr() _______________________________________________ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit