Compability issues with Python 2.5

Keith Jackson KRJackson at lbl.gov
Tue Sep 19 00:25:28 CEST 2006


I don't have time, but when I converted a bunch of my code I found  
http://svn.effbot.python-hosting.com/stuff/sandbox/python/ 
ssizecheck.py to be very useful.
--keith

On Sep 18, 2006, at 1:45 PM, Michael Ströder wrote:

> HI!
>
> I suspect that python-ldap has some issues regarding changes in the C
> API of Python 2.5. web2ldap with recent python-ldap crashes quite  
> often.
>
> Since my C knowledge is quite bad I need some volunteers. Anyone  
> willing
> to spend some spare time digging under Modules/ is encouraged to read
> PEP 0353 and "What's New in Python 2.5":
>
> http://docs.python.org/dev/whatsnew/ports.html
>
> http://docs.python.org/dev/whatsnew/section-other.html (last two items
> starting with "C API:")
>
> http://www.python.org/dev/peps/pep-0353/#conversion-guidelines
>
> I've attached a unified patch of my first try to address these issues.
> But I won't commit them now. Please review.
>
> Ciao, Michael.
> Index: Modules/ldapcontrol.c
> ===================================================================
> RCS file: /cvsroot/python-ldap/python-ldap/Modules/ldapcontrol.c,v
> retrieving revision 1.5
> diff -u -r1.5 ldapcontrol.c
> --- Modules/ldapcontrol.c	10 Apr 2006 05:19:46 -0000	1.5
> +++ Modules/ldapcontrol.c	18 Sep 2006 20:38:08 -0000
> @@ -130,7 +130,7 @@
>  LDAPControl**
>  List_to_LDAPControls( PyObject* list )
>  {
> -    int len, i;
> +    Py_ssize_t len, i;
>      LDAPControl** ldcs;
>      LDAPControl* ldc;
>      PyObject* item;
> @@ -173,7 +173,7 @@
>  {
>      PyObject *res = 0, *pyctrl;
>      LDAPControl **tmp = ldcs;
> -    unsigned num_ctrls = 0, i;
> +    Py_ssize_t num_ctrls = 0, i;
>
>      if (tmp)
>          while (*tmp++) num_ctrls++;
> Index: Modules/LDAPObject.c
> ===================================================================
> RCS file: /cvsroot/python-ldap/python-ldap/Modules/LDAPObject.c,v
> retrieving revision 1.75
> diff -u -r1.75 LDAPObject.c
> --- Modules/LDAPObject.c	18 Apr 2006 11:17:30 -0000	1.75
> +++ Modules/LDAPObject.c	18 Sep 2006 20:38:09 -0000
> @@ -210,7 +210,7 @@
>  static LDAPMod**
>  List_to_LDAPMods( PyObject *list, int no_op ) {
>
> -    int i, len;
> +    Py_ssize_t i, len;
>      LDAPMod** lms;
>      PyObject *item;
>
> @@ -263,7 +263,7 @@
>  attrs_from_List( PyObject *attrlist, char***attrsp ) {
>
>      char **attrs = NULL;
> -    int i, len;
> +    Py_ssize_t i, len;
>      PyObject *item;
>
>      if (attrlist == Py_None) {
> Index: Modules/options.c
> ===================================================================
> RCS file: /cvsroot/python-ldap/python-ldap/Modules/options.c,v
> retrieving revision 1.15
> diff -u -r1.15 options.c
> --- Modules/options.c	11 Mar 2006 21:11:40 -0000	1.15
> +++ Modules/options.c	18 Sep 2006 20:38:09 -0000
> @@ -156,7 +156,7 @@
>      LDAPControl *lc;
>      char *strval;
>      PyObject *extensions, *v, *tup;
> -    int i, num_extensions, num_controls;
> +    Py_ssize_t i, num_extensions, num_controls;
>      LDAP *ld;
>
>      ld = self ? self->ldap : NULL;
> 


More information about the python-ldap mailing list