[pypy-svn] r6272 - pypy/branch/pypy-genc/translator

arigo at codespeak.net arigo at codespeak.net
Thu Sep 2 17:53:01 CEST 2004


Author: arigo
Date: Thu Sep  2 17:53:01 2004
New Revision: 6272

Modified:
   pypy/branch/pypy-genc/translator/genc.h
   pypy/branch/pypy-genc/translator/genc.py
Log:
- OP_NEWSLICE_oooo().
- Bug fix: "g_IntObj_-1" is not a valid C identifier.


Modified: pypy/branch/pypy-genc/translator/genc.h
==============================================================================
--- pypy/branch/pypy-genc/translator/genc.h	(original)
+++ pypy/branch/pypy-genc/translator/genc.h	Thu Sep  2 17:53:01 2004
@@ -46,6 +46,7 @@
 #define OP_GETITEM_ooo(x,y,r,err)   if (!(r=PyObject_GetItem(x,y)))    goto err;
 #define OP_SETITEM_ooov(x,y,z,err)  if ((PyObject_SetItem(x,y,z))<0)   goto err;
 #define OP_GETATTR_ooo(x,y,r,err)   if (!(r=PyObject_GetAttr(x,y)))    goto err;
+#define OP_NEWSLICE_oooo(x,y,z,r,err)  if (!(r=PySlice_New(x,y,z)))    goto err;
 
 
 /*** conversions ***/

Modified: pypy/branch/pypy-genc/translator/genc.py
==============================================================================
--- pypy/branch/pypy-genc/translator/genc.py	(original)
+++ pypy/branch/pypy-genc/translator/genc.py	Thu Sep  2 17:53:01 2004
@@ -144,8 +144,12 @@
                 conv[r, self.R_INT] = writer, False
                 writer.known_answer = [LLConst(self.R_INT, '%d' % value)]
                 # can convert the constant to a PyObject*
+                if value >= 0:
+                    name = 'g_IntObj_%d' % value
+                else:
+                    name = 'g_IntObj_minus%d' % abs(value)
                 self.can_convert_to_pyobj(r, 'PyInt_FromLong(%d)' % value,
-                                          'g_IntObj_%d' % value)
+                                          name)
             elif isinstance(value, str):
                 # can convert the constant to a PyObject*
                 self.can_convert_to_pyobj(r,



More information about the Pypy-commit mailing list