[pypy-svn] r78859 - pypy/branch/fast-forward/pypy/module/cpyext

afa at codespeak.net afa at codespeak.net
Mon Nov 8 10:08:33 CET 2010


Author: afa
Date: Mon Nov  8 10:08:27 2010
New Revision: 78859

Modified:
   pypy/branch/fast-forward/pypy/module/cpyext/funcobject.py
Log:
Work around an annotation bug


Modified: pypy/branch/fast-forward/pypy/module/cpyext/funcobject.py
==============================================================================
--- pypy/branch/fast-forward/pypy/module/cpyext/funcobject.py	(original)
+++ pypy/branch/fast-forward/pypy/module/cpyext/funcobject.py	Mon Nov  8 10:08:27 2010
@@ -68,17 +68,18 @@
 @cpython_api([CONST_STRING, CONST_STRING, rffi.INT_real], PyObject)
 def PyCode_NewEmpty(space, filename, funcname, firstlineno):
     """Creates a new empty code object with the specified source location."""
-    raise OperationError(space.w_NotImplementedError, space.wrap(
-        "PyCode_NewEmpty"))
-    # XXX I keep getting a "TooLateForChange" around the annotation of
-    # the consts variable
+    # XXX Something that annotates as SomeInstance(knownType=W_Root)
+    # XXX looks like a bug in make_sure_not_modified() used by PyCode.___init__
+    # XXX which also depends on the annotation order
+    w_const = space.and_(space.w_True, space.w_None)
+
     return space.wrap(PyCode(space,
                              argcount=0,
                              nlocals=0,
                              stacksize=0,
                              flags=0,
                              code="",
-                             consts=list([]),
+                             consts=[w_const],
                              names=[],
                              varnames=[],
                              filename=rffi.charp2str(filename),



More information about the Pypy-commit mailing list