[pypy-svn] r15310 - pypy/dist/pypy/interpreter

arigo at codespeak.net arigo at codespeak.net
Fri Jul 29 01:57:36 CEST 2005


Author: arigo
Date: Fri Jul 29 01:57:34 2005
New Revision: 15310

Modified:
   pypy/dist/pypy/interpreter/pycompiler.py
Log:
Check that the app-level compiler returns a code object.
(Needed to help the annotator, too)


Modified: pypy/dist/pypy/interpreter/pycompiler.py
==============================================================================
--- pypy/dist/pypy/interpreter/pycompiler.py	(original)
+++ pypy/dist/pypy/interpreter/pycompiler.py	Fri Jul 29 01:57:34 2005
@@ -115,7 +115,7 @@
         except TypeError,e:
             raise OperationError(space.w_TypeError,space.wrap(str(e)))
         from pypy.interpreter.pycode import PyCode
-        return space.wrap(PyCode(space)._from_code(c))
+        return PyCode(space)._from_code(c)
     compile._annspecialcase_ = "override:cpy_compile"
 
     def getcodeflags(self, code):
@@ -189,8 +189,7 @@
         except ParseError, e:
             raise OperationError(space.w_SyntaxError,
                                  e.wrap_info(space, filename))
-        w_code = self.compile_parse_result(parse_result, filename, mode)
-        return w_code
+        return self.compile_parse_result(parse_result, filename, mode)
 
     def compile_parse_result(self, parse_result, filename, mode):
         """NOT_RPYTHON"""
@@ -230,7 +229,7 @@
             raise OperationError(space.w_TypeError,space.wrap(str(e)))
         # __________ end of XXX above
         from pypy.interpreter.pycode import PyCode
-        return space.wrap(PyCode(space)._from_code(c))
+        return PyCode(space)._from_code(c)
     compile_parse_result._annspecialcase_ = 'override:cpy_stablecompiler'
 
 
@@ -287,7 +286,11 @@
                                      w_nested_tuples,
                                      space.wrap(filename),
                                      space.wrap(mode))
-        return w_code
+        code = space.interpclass_w(w_code)
+        if not isinstance(code, PyCode):
+            raise OperationError(space.w_RuntimeError,
+                                 space.wrap("code object expected"))
+        return code
 
 
 class PyPyCompiler(CPythonCompiler):



More information about the Pypy-commit mailing list