[pypy-svn] r10609 - pypy/dist/pypy/translator/genc

arigo at codespeak.net arigo at codespeak.net
Thu Apr 14 12:42:20 CEST 2005


Author: arigo
Date: Thu Apr 14 12:42:19 2005
New Revision: 10609

Modified:
   pypy/dist/pypy/translator/genc/pyobj_include.h
Log:
Small fix in OP_ORD().
Moved OP_ORD and OP_STR out of the numerical operations part.



Modified: pypy/dist/pypy/translator/genc/pyobj_include.h
==============================================================================
--- pypy/dist/pypy/translator/genc/pyobj_include.h	(original)
+++ pypy/dist/pypy/translator/genc/pyobj_include.h	Thu Apr 14 12:42:19 2005
@@ -51,20 +51,6 @@
 #define OP_OR_(x,y,r,err)         if (!(r=PyNumber_Or(x,y)))         FAIL(err)
 #define OP_XOR(x,y,r,err)         if (!(r=PyNumber_Xor(x,y)))        FAIL(err)
 
-#define OP_STR(x,r,err)           if (!(r=PyObject_Str(x)))          FAIL(err)
-#define OP_ORD(s,r,err) { \
-        char *__c = PyString_AsString(s); \
-        int __len; \
-        if ( !__c && (__len = PyString_GET_SIZE(s)) != 1) { \
-            PyErr_Format(PyExc_TypeError, \
-                  "ord() expected a character, but string of length %d found", \
-                  __len); \
-            FAIL(err) \
-        } \
-        if (!__c || !(r = PyInt_FromLong((unsigned char)(__c[0])))) \
-            FAIL(err) \
-    }
-
 #define OP_INPLACE_ADD(x,y,r,err) if (!(r=PyNumber_InPlaceAdd(x,y)))           \
 								     FAIL(err)
 #define OP_INPLACE_SUB(x,y,r,err) if (!(r=PyNumber_InPlaceSubtract(x,y)))      \
@@ -134,6 +120,21 @@
 		FAIL(err)                                                      \
 	}
 
+#define OP_STR(x,r,err)           if (!(r=PyObject_Str(x)))          FAIL(err)
+#define OP_ORD(s,r,err) { \
+	char *__c = PyString_AsString(s); \
+	int __len; \
+	if ( !__c) FAIL(err) \
+	if ((__len = PyString_GET_SIZE(s)) != 1) { \
+	    PyErr_Format(PyExc_TypeError, \
+		  "ord() expected a character, but string of length %d found", \
+		  __len); \
+	    FAIL(err) \
+	} \
+	if (!(r = PyInt_FromLong((unsigned char)(__c[0])))) \
+	    FAIL(err) \
+    }
+
 #define OP_SIMPLE_CALL(args,r,err) if (!(r=PyObject_CallFunctionObjArgs args)) \
 					FAIL(err)
 #define OP_CALL_ARGS(args,r,err)   if (!(r=CallWithShape args))    FAIL(err)



More information about the Pypy-commit mailing list