[pypy-svn] r61663 - in pypy/trunk/pypy: config interpreter interpreter/astcompiler interpreter/pyparser/data interpreter/pyparser/test interpreter/test module/_file/test module/marshal module/recparser module/symbol

arigo at codespeak.net arigo at codespeak.net
Mon Feb 9 16:22:58 CET 2009


Author: arigo
Date: Mon Feb  9 16:22:57 2009
New Revision: 61663

Removed:
   pypy/trunk/pypy/interpreter/pyparser/data/Grammar2.3
   pypy/trunk/pypy/interpreter/pyparser/data/Grammar2.4
Modified:
   pypy/trunk/pypy/config/pypyoption.py
   pypy/trunk/pypy/interpreter/astcompiler/pycodegen.py
   pypy/trunk/pypy/interpreter/pycompiler.py
   pypy/trunk/pypy/interpreter/pyparser/test/test_astbuilder.py
   pypy/trunk/pypy/interpreter/pyparser/test/test_pytokenizer.py
   pypy/trunk/pypy/interpreter/test/test_compiler.py
   pypy/trunk/pypy/interpreter/test/test_syntax.py
   pypy/trunk/pypy/module/_file/test/test_file.py
   pypy/trunk/pypy/module/marshal/interp_marshal.py
   pypy/trunk/pypy/module/recparser/compat.py
   pypy/trunk/pypy/module/symbol/__init__.py
Log:
(fijal, arigo)
Kill the --pyversion command-line option.  Always use 2.5 for now.


Modified: pypy/trunk/pypy/config/pypyoption.py
==============================================================================
--- pypy/trunk/pypy/config/pypyoption.py	(original)
+++ pypy/trunk/pypy/config/pypyoption.py	Mon Feb  9 16:22:57 2009
@@ -110,10 +110,6 @@
                  ["cpython", "ast"], "ast",
                  cmdline='--compiler'),
 
-    ChoiceOption("pyversion", "which grammar to use for app-level code",
-                 ["2.3", "2.4", "2.5"], "2.5",
-                 cmdline='--pyversion'),
-
     OptionDescription("opcodes", "opcodes to enable in the interpreter", [
         BoolOption("CALL_LIKELY_BUILTIN", "emit a special bytecode for likely calls to builtin functions",
                    default=False,

Modified: pypy/trunk/pypy/interpreter/astcompiler/pycodegen.py
==============================================================================
--- pypy/trunk/pypy/interpreter/astcompiler/pycodegen.py	(original)
+++ pypy/trunk/pypy/interpreter/astcompiler/pycodegen.py	Mon Feb  9 16:22:57 2009
@@ -1143,13 +1143,6 @@
         self.emit('RETURN_VALUE')
 
     def visitYield(self, node):
-        if self.space.config.objspace.pyversion < '2.5':
-            if len(self.setups):
-                kind, block = self.setups[-1]
-                if kind  == TRY_FINALLY:
-                    raise SyntaxError("'yield' not allowed in a 'try' block "
-                                  "with a 'finally' clause",
-                                  node.lineno)
         self.set_lineno(node)
         node.value.accept( self )
         self.emit('YIELD_VALUE')

Modified: pypy/trunk/pypy/interpreter/pycompiler.py
==============================================================================
--- pypy/trunk/pypy/interpreter/pycompiler.py	(original)
+++ pypy/trunk/pypy/interpreter/pycompiler.py	Mon Feb  9 16:22:57 2009
@@ -217,7 +217,7 @@
 
         from pyparser.pythonparse import make_pyparser
         PyCodeCompiler.__init__(self, space)
-        self.grammar_version = override_version or space.config.objspace.pyversion
+        self.grammar_version = override_version or "2.5"
         self.parser = make_pyparser(self.grammar_version)
         self.additional_rules = {}
         if self.grammar_version >= '2.5':

Modified: pypy/trunk/pypy/interpreter/pyparser/test/test_astbuilder.py
==============================================================================
--- pypy/trunk/pypy/interpreter/pyparser/test/test_astbuilder.py	(original)
+++ pypy/trunk/pypy/interpreter/pyparser/test/test_astbuilder.py	Mon Feb  9 16:22:57 2009
@@ -188,13 +188,13 @@
     t = Transformer("dummyfile")
     return ast_from_input(expr, target, t, stable_parser)
 
-def source2ast(source, mode, space=FakeSpace(), version='2.4'):
+def source2ast(source, mode, space=FakeSpace(), version='2.5'):
     python_parser = pythonparse.make_pyparser(version)
     builder = AstBuilder(python_parser, version, space=space)
     python_parser.parse_source(source, mode, builder)
     return builder.rule_stack[-1]
 
-def check_expression(expr, mode='single', version='2.4'):
+def check_expression(expr, mode='single', version='2.5'):
     pypy_ast = source2ast(expr, mode, version=version)
     try:
         python_ast = EXPECTED[expr]

Modified: pypy/trunk/pypy/interpreter/pyparser/test/test_pytokenizer.py
==============================================================================
--- pypy/trunk/pypy/interpreter/pyparser/test/test_pytokenizer.py	(original)
+++ pypy/trunk/pypy/interpreter/pyparser/test/test_pytokenizer.py	Mon Feb  9 16:22:57 2009
@@ -3,7 +3,7 @@
 from pypy.interpreter.pyparser.grammar import Token, GrammarElement
 from pypy.interpreter.pyparser.pythonparse import make_pyparser, _check_for_encoding
 
-P = make_pyparser('2.4')
+P = make_pyparser('2.5')
 
 EQUAL = P.tokens['EQUAL']
 ENDMARKER = P.tokens['ENDMARKER']

Modified: pypy/trunk/pypy/interpreter/test/test_compiler.py
==============================================================================
--- pypy/trunk/pypy/interpreter/test/test_compiler.py	(original)
+++ pypy/trunk/pypy/interpreter/test/test_compiler.py	Mon Feb  9 16:22:57 2009
@@ -255,10 +255,7 @@
 
     def test_yield_in_finally(self):
         code ='def f():\n try:\n  yield 19\n finally:\n  pass\n'
-        e = py.test.raises(OperationError, self.compiler.compile, code, '', 'single', 0)
-        ex = e.value
-        ex.normalize_exception(self.space)
-        assert ex.match(self.space, self.space.w_SyntaxError)
+        self.compiler.compile(code, '', 'single', 0)
 
     def test_none_assignment(self):
         stmts = [
@@ -651,10 +648,7 @@
             py.test.skip("syntax not supported by the CPython 2.4 compiler")
         test_continue_in_nested_finally = skip_on_2_4
         test_try_except_finally = skip_on_2_4
-    elif sys.version_info > (2, 4):
-        def skip_on_2_5(self):
-            py.test.skip("syntax changed in CPython 2.5 compiler")
-        test_yield_in_finally = skip_on_2_5
+        test_yield_in_finally = skip_on_2_4
 
 class TestPythonAstCompiler_25_grammar(BaseTestCompiler):
     def setup_method(self, method):
@@ -690,10 +684,6 @@
         else:
             py.test.fail("Did not raise")
 
-    def test_yield_in_finally(self): # behavior changed in 2.5
-        code ='def f():\n try:\n  yield 19\n finally:\n  pass\n'
-        self.compiler.compile(code, '', 'single', 0)
-
     def test_assign_to_yield(self):
         code = 'def f(): (yield bar) += y'
         try:
@@ -716,17 +706,15 @@
 
 class TestECCompiler(BaseTestCompiler):
     def setup_method(self, method):
-        self.space.config.objspace.pyversion = "2.4"
         self.compiler = self.space.getexecutioncontext().compiler
 
 
-class TestPythonAstCompiler(BaseTestCompiler):
-    def setup_method(self, method):
-        self.space.config.objspace.pyversion = "2.4"
-        self.compiler = PythonAstCompiler(self.space, "2.4")
+##class TestPythonAstCompiler(BaseTestCompiler):
+##    def setup_method(self, method):
+##        self.compiler = PythonAstCompiler(self.space, "2.4")
 
-    def test_try_except_finally(self):
-        py.test.skip("unsupported")
+##    def test_try_except_finally(self):
+##        py.test.skip("unsupported")
 
 class AppTestOptimizer:
     def test_constant_fold_add(self):

Modified: pypy/trunk/pypy/interpreter/test/test_syntax.py
==============================================================================
--- pypy/trunk/pypy/interpreter/test/test_syntax.py	(original)
+++ pypy/trunk/pypy/interpreter/test/test_syntax.py	Mon Feb  9 16:22:57 2009
@@ -257,12 +257,7 @@
         raise
 
 
-class Py25AppTest:
-    def setup_class(self):
-        self.space = gettestobjspace(pyversion='2.5')
-        return
-
-class AppTestCondExpr(Py25AppTest):
+class AppTestCondExpr:
     def test_condexpr(self):
         for s, expected in [("x = 1 if True else 2", 1),
                             ("x = 1 if False else 2", 2)]:
@@ -276,13 +271,13 @@
         exec "1 if True else 2"
         warnings.simplefilter('default', SyntaxWarning)
 
-class AppTestYield(Py25AppTest):
+class AppTestYield:
     def test_bare_yield(self):
         s = "def f():\n    yield"
 
         exec s
 
-class AppTestWith(Py25AppTest):
+class AppTestWith:
     def test_with_simple(self):
 
         s = """from __future__ import with_statement

Modified: pypy/trunk/pypy/module/_file/test/test_file.py
==============================================================================
--- pypy/trunk/pypy/module/_file/test/test_file.py	(original)
+++ pypy/trunk/pypy/module/_file/test/test_file.py	Mon Feb  9 16:22:57 2009
@@ -253,7 +253,7 @@
 
 class AppTestFile25:
     def setup_class(cls):
-        cls.space = gettestobjspace(usemodules=("_file", ), pyversion="2.5")
+        cls.space = gettestobjspace(usemodules=("_file", ))
         cls.w_temppath = cls.space.wrap(
             str(py.test.ensuretemp("fileimpl").join("foo.txt")))
         cls.w_file = getfile(cls.space)

Modified: pypy/trunk/pypy/module/marshal/interp_marshal.py
==============================================================================
--- pypy/trunk/pypy/module/marshal/interp_marshal.py	(original)
+++ pypy/trunk/pypy/module/marshal/interp_marshal.py	Mon Feb  9 16:22:57 2009
@@ -5,13 +5,7 @@
 from pypy.module._file.interp_stream import StreamErrors, wrap_streamerror
 import sys
 
-# Py_MARSHAL_VERSION = 2
-# this is from Python 2.5
-# already implemented, but for compatibility,
-# we default to version 1. Version 2 can be
-# tested, anyway, by using the optional parameter.
-# XXX make it 2 when used with --pyversion=2.5 translation
-Py_MARSHAL_VERSION = 1
+Py_MARSHAL_VERSION = 2
 
 def dump(space, w_data, w_f, w_version=Py_MARSHAL_VERSION):
     """Write the 'data' object into the open file 'f'."""

Modified: pypy/trunk/pypy/module/recparser/compat.py
==============================================================================
--- pypy/trunk/pypy/module/recparser/compat.py	(original)
+++ pypy/trunk/pypy/module/recparser/compat.py	Mon Feb  9 16:22:57 2009
@@ -12,7 +12,7 @@
     if not _PARSER:
         from pypy.config.pypyoption import get_pypy_config
         config = get_pypy_config(translating=False)
-        _PARSER = make_pyparser(config.objspace.pyversion)
+        _PARSER = make_pyparser("2.5")
     return _PARSER
 
 def suite( source ):

Modified: pypy/trunk/pypy/module/symbol/__init__.py
==============================================================================
--- pypy/trunk/pypy/module/symbol/__init__.py	(original)
+++ pypy/trunk/pypy/module/symbol/__init__.py	Mon Feb  9 16:22:57 2009
@@ -16,10 +16,6 @@
     appleveldefs = {}
     interpleveldefs = {}     # see below
 
-    def __init__(self, space, w_name):
-        MixedModule.__init__(self, space, w_name)
-        _init_symbols(space.config.objspace.pyversion)
-
 
 # Export the values from our custom symbol module.
 # Skip negative values (the corresponding symbols are not visible in



More information about the Pypy-commit mailing list