Log message for revision 102444:
  Made C extensions work for 64-bit Python 2.5.x / 2.6.x.
  

Changed:
  U   Zope/trunk/doc/CHANGES.rst
  U   Zope/trunk/src/AccessControl/cAccessControl.c
  U   Zope/trunk/src/Record/_Record.c

-=-
Modified: Zope/trunk/doc/CHANGES.rst
===================================================================
--- Zope/trunk/doc/CHANGES.rst  2009-08-02 20:56:09 UTC (rev 102443)
+++ Zope/trunk/doc/CHANGES.rst  2009-08-02 20:57:40 UTC (rev 102444)
@@ -56,6 +56,11 @@
 Bugs Fixed
 ++++++++++
 
+- Made C extensions work for 64-bit Python 2.5.x / 2.6.x.
+
+- Unfutzed test failures due to use of naive timezones with ``datetime``
+  instances.
+
 - LP #397861: exporting $PYTHON in generated 'zopectl' for fixing import issue
   with "bin/zopectl adduser"
 

Modified: Zope/trunk/src/AccessControl/cAccessControl.c
===================================================================
--- Zope/trunk/src/AccessControl/cAccessControl.c       2009-08-02 20:56:09 UTC 
(rev 102443)
+++ Zope/trunk/src/AccessControl/cAccessControl.c       2009-08-02 20:57:40 UTC 
(rev 102444)
@@ -54,7 +54,18 @@
 #include <stdio.h>
 #include <stdlib.h>
 
+#if PY_VERSION_HEX < 0x02050000 && !defined(PY_SSIZE_T_MIN)
+typedef int Py_ssize_t;
+typedef Py_ssize_t (*lenfunc)(PyObject *);
+typedef PyObject *(*ssizeargfunc)(PyObject *, Py_ssize_t);
+typedef PyObject *(*ssizessizeargfunc)(PyObject *, Py_ssize_t, Py_ssize_t);
+typedef int(*ssizeobjargproc)(PyObject *, Py_ssize_t, PyObject *);
+typedef int(*ssizessizeobjargproc)(PyObject *, Py_ssize_t, Py_ssize_t, 
PyObject *);
+#define PY_SSIZE_T_MAX INT_MAX
+#define PY_SSIZE_T_MIN INT_MIN
+#endif
 
+
 static void
 PyVar_Assign(PyObject **v,  PyObject *e)
 {
@@ -349,9 +360,9 @@
 static PyObject *PermissionRole_getattro(PermissionRole *self, PyObject *name);
 
 static PyObject *imPermissionRole_of(imPermissionRole *self, PyObject *parent);
-static int imPermissionRole_length(imPermissionRole *self);
+static Py_ssize_t imPermissionRole_length(imPermissionRole *self);
 static PyObject *imPermissionRole_get(imPermissionRole *self,
-       int item);
+       Py_ssize_t item);
 static void imPermissionRole_dealloc(imPermissionRole *self);
 
 static PyObject *rolesForPermissionOn(PyObject *self, PyObject *args);
@@ -593,16 +604,16 @@
 };
 
 static PySequenceMethods imSequenceMethods = {
-       (inquiry) imPermissionRole_length,      /* sq_length    */
+       (lenfunc) imPermissionRole_length,      /* sq_length    */
        (binaryfunc) NULL,                      /* sq_concat    */
-       (intargfunc) NULL,                      /* sq_repeat    */
-       (intargfunc) imPermissionRole_get,      /* sq_item      */
-       (intintargfunc) NULL,                   /* sq_slice     */
-       (intobjargproc)  NULL,                  /* sq_ass_item  */
-       (intintobjargproc) NULL,                /* sq_ass_slice */
+       (ssizeargfunc) NULL,                    /* sq_repeat    */
+       (ssizeargfunc) imPermissionRole_get,    /* sq_item      */
+       (ssizessizeargfunc) NULL,                       /* sq_slice     */
+       (ssizeobjargproc)  NULL,                        /* sq_ass_item  */
+       (ssizessizeobjargproc) NULL,            /* sq_ass_slice */
        (objobjproc) NULL,                      /* sq_contains  */
        (binaryfunc) NULL,                      /* sq_inplace_concat */
-       (intargfunc) NULL                       /* sq_inplace_repeat */
+       (ssizeargfunc) NULL                     /* sq_inplace_repeat */
 };
 
 static PyExtensionClass imPermissionRoleType = {
@@ -1613,9 +1624,9 @@
 /*
 ** imPermissionRole_length
 */
-static int imPermissionRole_length(imPermissionRole *self) {
+static Py_ssize_t imPermissionRole_length(imPermissionRole *self) {
 
-       int l;
+       Py_ssize_t l;
        PyObject *v;
        PyObject *pa;
 
@@ -1654,7 +1665,7 @@
 */
 
 static PyObject *imPermissionRole_get(imPermissionRole *self,
-       int item) {
+       Py_ssize_t item) {
 
        PyObject *v;
        PyObject *pa;

Modified: Zope/trunk/src/Record/_Record.c
===================================================================
--- Zope/trunk/src/Record/_Record.c     2009-08-02 20:56:09 UTC (rev 102443)
+++ Zope/trunk/src/Record/_Record.c     2009-08-02 20:57:40 UTC (rev 102444)
@@ -21,6 +21,17 @@
 
 /* ----------------------------------------------------- */
 
+#if PY_VERSION_HEX < 0x02050000 && !defined(PY_SSIZE_T_MIN)
+typedef int Py_ssize_t;
+typedef Py_ssize_t (*lenfunc)(PyObject *);
+typedef PyObject *(*ssizeargfunc)(PyObject *, Py_ssize_t);
+typedef PyObject *(*ssizessizeargfunc)(PyObject *, Py_ssize_t, Py_ssize_t);
+typedef int(*ssizeobjargproc)(PyObject *, Py_ssize_t, PyObject *);
+typedef int(*ssizessizeobjargproc)(PyObject *, Py_ssize_t, Py_ssize_t, 
PyObject *);
+#define PY_SSIZE_T_MAX INT_MAX
+#define PY_SSIZE_T_MIN INT_MIN
+#endif
+
 static void PyVar_Assign(PyObject **v, PyObject *e) { Py_XDECREF(*v); *v=e;}
 #define ASSIGN(V,E) PyVar_Assign(&(V),(E))
 #define UNLESS(E) if(!(E))
@@ -41,10 +52,10 @@
 
 /* ---------------------------------------------------------------- */
 
-static int
+static Py_ssize_t
 Record_init(Record *self)
 {
-  int l;
+  Py_ssize_t l;
 
   UNLESS(self->schema)
     UNLESS(self->schema=PyObject_GetAttr(OBJECT(self->ob_type),
@@ -67,7 +78,7 @@
 Record___setstate__(Record *self, PyObject *args)
 {
   PyObject *state=0, *parent, **d;
-  int l, ls, i;
+  Py_ssize_t l, ls, i;
 
   if((l=Record_init(self)) < 0) return NULL;
 
@@ -102,7 +113,7 @@
 Record___getstate__( Record *self, PyObject *args)
 {
   PyObject *r, **d, *v;
-  int i, l;
+  Py_ssize_t i, l;
 
   UNLESS(self->data) return PyTuple_New(0);
 
@@ -162,7 +173,7 @@
 static PyObject *
 Record_getattr(Record *self, PyObject *name)
 {
-  int l, i;
+  Py_ssize_t l, i;
   PyObject *io;
 
   if((l=Record_init(self)) < 0) return NULL;
@@ -197,7 +208,7 @@
 static int
 Record_setattr(Record *self, PyObject *name, PyObject *v)
 {
-  int l, i;
+  Py_ssize_t l, i;
   PyObject *io;
 
   if((l=Record_init(self)) < 0) return -1;
@@ -225,7 +236,8 @@
 static int
 Record_compare(Record *v, Record *w)
 {
-  int lv, lw, i, c;
+  Py_ssize_t lv, lw, i;
+  int c;
   PyObject **dv, **dw;
 
   if((lv=Record_init(v)) < 0) return -1;
@@ -258,7 +270,7 @@
 }
 
 static PyObject *
-Record_repeat(Record *self, int n)
+Record_repeat(Record *self, Py_ssize_t n)
 {
   PyErr_SetString(PyExc_TypeError,
                  "Record objects do not support repetition");
@@ -280,10 +292,10 @@
 }
 
 static PyObject *
-Record_item(Record *self, int i)
+Record_item(Record *self, Py_ssize_t i)
 {
   PyObject *o;
-  int l;
+  Py_ssize_t l;
 
   if((l=Record_init(self)) < 0) return NULL;
   if(i < 0 || i >= l) return IndexError(i);
@@ -296,7 +308,7 @@
 }
 
 static PyObject *
-Record_slice(Record *self, int ilow, int ihigh)
+Record_slice(Record *self, Py_ssize_t ilow, Py_ssize_t ihigh)
 {
   PyErr_SetString(PyExc_TypeError,
                  "Record objects do not support slicing");
@@ -304,9 +316,9 @@
 }
 
 static int
-Record_ass_item(Record *self, int i, PyObject *v)
+Record_ass_item(Record *self, Py_ssize_t i, PyObject *v)
 {
-  int l;
+  Py_ssize_t l;
 
   if((l=Record_init(self)) < 0) return -1;
   if(i < 0 || i >= l)
@@ -335,13 +347,13 @@
 }
 
 static PySequenceMethods Record_as_sequence = {
-  (inquiry)Record_init,                        /*sq_length*/
+  (lenfunc)Record_init,                        /*sq_length*/
   (binaryfunc)Record_concat,           /*sq_concat*/
-  (intargfunc)Record_repeat,           /*sq_repeat*/
-  (intargfunc)Record_item,             /*sq_item*/
-  (intintargfunc)Record_slice,         /*sq_slice*/
-  (intobjargproc)Record_ass_item,      /*sq_ass_item*/
-  (intintobjargproc)Record_ass_slice,  /*sq_ass_slice*/
+  (ssizeargfunc)Record_repeat,         /*sq_repeat*/
+  (ssizeargfunc)Record_item,           /*sq_item*/
+  (ssizessizeargfunc)Record_slice,             /*sq_slice*/
+  (ssizeobjargproc)Record_ass_item,    /*sq_ass_item*/
+  (ssizessizeobjargproc)Record_ass_slice,      /*sq_ass_slice*/
 };
 
 /* -------------------------------------------------------------- */
@@ -349,7 +361,7 @@
 static PyObject *
 Record_subscript(Record *self, PyObject *key)
 {
-  int i, l;
+  Py_ssize_t i, l;
   PyObject *io;
 
   if((l=Record_init(self)) < 0) return NULL;
@@ -389,7 +401,7 @@
 static int
 Record_ass_sub(Record *self, PyObject *key, PyObject *v)
 {
-  int i, l;
+  Py_ssize_t i, l;
   PyObject *io;
 
   if((l=Record_init(self)) < 0) return -1;
@@ -422,7 +434,7 @@
 }
 
 static PyMappingMethods Record_as_mapping = {
-  (inquiry)Record_init,                /*mp_length*/
+  (lenfunc)Record_init,                /*mp_length*/
   (binaryfunc)Record_subscript,                /*mp_subscript*/
   (objobjargproc)Record_ass_sub,       /*mp_ass_subscript*/
 };

_______________________________________________
Zope-Checkins maillist  -  Zope-Checkins@zope.org
http://mail.zope.org/mailman/listinfo/zope-checkins

Reply via email to