[pypy-svn] r60915 - in pypy/trunk/pypy: interpreter/astcompiler module/__builtin__/test
antocuni at codespeak.net
antocuni at codespeak.net
Tue Jan 13 14:20:34 CET 2009
Author: antocuni
Date: Tue Jan 13 14:20:32 2009
New Revision: 60915
Modified:
pypy/trunk/pypy/interpreter/astcompiler/pycodegen.py
pypy/trunk/pypy/module/__builtin__/test/test_builtin.py
Log:
a failing test and the corresponding fix. I don't really understand why the
code called SET_LINENO, but since it's in the compiler I assume it was bogus
:-). Tests passes, this should fix a failure in lib-python/test_compile
Modified: pypy/trunk/pypy/interpreter/astcompiler/pycodegen.py
==============================================================================
--- pypy/trunk/pypy/interpreter/astcompiler/pycodegen.py (original)
+++ pypy/trunk/pypy/interpreter/astcompiler/pycodegen.py Tue Jan 13 14:20:32 2009
@@ -265,7 +265,6 @@
self.parseSymbols(node)
assert node.scope is not None
self.scope = node.scope
- self.emitop_int('SET_LINENO', 0)
if not space.is_w(node.w_doc, space.w_None):
self.setDocstring(node.w_doc)
self.set_lineno(node)
Modified: pypy/trunk/pypy/module/__builtin__/test/test_builtin.py
==============================================================================
--- pypy/trunk/pypy/module/__builtin__/test/test_builtin.py (original)
+++ pypy/trunk/pypy/module/__builtin__/test/test_builtin.py Tue Jan 13 14:20:32 2009
@@ -473,6 +473,14 @@
raises(TypeError, hasattr, x, 42)
raises(UnicodeError, hasattr, x, u'\u5678') # cannot encode attr name
+ def test_compile_leading_newlines(self):
+ src = """
+def fn(): pass
+"""
+ co = compile(src, 'mymod', 'exec')
+ firstlineno = co.co_firstlineno
+ assert firstlineno == 2
+
class AppTestBuiltinOptimized(object):
def setup_class(cls):
from pypy.conftest import gettestobjspace
@@ -528,7 +536,7 @@
exec s in ns
res = ns["test"]([2,3,4])
assert res == 18
-
+
class TestInternal:
More information about the Pypy-commit
mailing list