[pypy-svn] r75193 - pypy/trunk/pypy/module/cpyext/patches

afa at codespeak.net afa at codespeak.net
Tue Jun 8 15:03:44 CEST 2010


Author: afa
Date: Tue Jun  8 15:03:42 2010
New Revision: 75193

Added:
   pypy/trunk/pypy/module/cpyext/patches/cx_Oracle.patch   (contents, props changed)
Log:
cx_Oracle now works, with this patch.


Added: pypy/trunk/pypy/module/cpyext/patches/cx_Oracle.patch
==============================================================================
--- (empty file)
+++ pypy/trunk/pypy/module/cpyext/patches/cx_Oracle.patch	Tue Jun  8 15:03:42 2010
@@ -0,0 +1,60 @@
+Index: cx_Oracle.c
+===================================================================
+--- cx_Oracle.c	(révision 333)
++++ cx_Oracle.c	(copie de travail)
+@@ -65,6 +65,13 @@
+ #define CXORA_BASE_EXCEPTION    PyExc_StandardError
+ #endif
+ 
++// define missing PyDateTime_DELTA macros
++#ifndef PYPY_VERSION
++PyDateTime_DELTA_GET_DAYS(o)         (((PyDateTime_Delta*)o)->days)
++PyDateTime_DELTA_GET_SECONDS(o)      (((PyDateTime_Delta*)o)->seconds)
++PyDateTime_DELTA_GET_MICROSECONDS(o) (((PyDateTime_Delta*)o)->microseconds)
++#endif
++
+ // define simple construct for determining endianness of the platform
+ // Oracle uses native encoding with OCI_UTF16 but bails when a BOM is written
+ #define IS_LITTLE_ENDIAN (int)*(unsigned char*) &one
+@@ -138,6 +145,7 @@
+     *exception = PyErr_NewException(buffer, baseException, NULL);
+     if (!*exception)
+         return -1;
++    Py_INCREF(*exception);
+     return PyModule_AddObject(module, name, *exception);
+ }
+ 
+Index: IntervalVar.c
+===================================================================
+--- IntervalVar.c	(révision 333)
++++ IntervalVar.c	(copie de travail)
+@@ -121,7 +121,7 @@
+     unsigned pos,                       // array position to set
+     PyObject *value)                    // value to set
+ {
+-    sb4 hours, minutes, seconds;
++    sb4 days, hours, minutes, seconds, microseconds;
+     PyDateTime_Delta *delta;
+     sword status;
+ 
+@@ -131,13 +131,16 @@
+     }
+ 
+     delta = (PyDateTime_Delta*) value;
+-    hours = (sb4) delta->seconds / 3600;
+-    seconds = delta->seconds - hours * 3600;
++    days = PyDateTime_DELTA_GET_DAYS(delta);
++    seconds = PyDateTime_DELTA_GET_SECONDS(delta);
++    hours = (sb4) seconds / 3600;
++    seconds -= hours * 3600;
+     minutes = (sb4) seconds / 60;
+     seconds -= minutes * 60;
++    microseconds = PyDateTime_DELTA_GET_MICROSECONDS(delta);
+     status = OCIIntervalSetDaySecond(var->environment->handle,
+-            var->environment->errorHandle, delta->days, hours, minutes,
+-            seconds, delta->microseconds, var->data[pos]);
++            var->environment->errorHandle, days, hours, minutes,
++            seconds, microseconds, var->data[pos]);
+     if (Environment_CheckForError(var->environment, status,
+                 "IntervalVar_SetValue()") < 0)
+         return -1;



More information about the Pypy-commit mailing list