From: <mi...@st...> - 2006-09-18 20:45:48
Attachments:
python-ldap_pep-0353.1stpatchset
|
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. |
From: Keith J. <KRJ...@lb...> - 2006-09-18 22:25:38
|
I don't have time, but when I converted a bunch of my code I found =20 http://svn.effbot.python-hosting.com/stuff/sandbox/python/=20 ssizecheck.py to be very useful. --keith On Sep 18, 2006, at 1:45 PM, Michael Str=F6der 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 =20 > often. > > Since my C knowledge is quite bad I need some volunteers. Anyone =20 > 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 > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > 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 =3D 0, *pyctrl; > LDAPControl **tmp =3D ldcs; > - unsigned num_ctrls =3D 0, i; > + Py_ssize_t num_ctrls =3D 0, i; > > if (tmp) > while (*tmp++) num_ctrls++; > Index: Modules/LDAPObject.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > 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 =3D NULL; > - int i, len; > + Py_ssize_t i, len; > PyObject *item; > > if (attrlist =3D=3D Py_None) { > Index: Modules/options.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > 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 =3D self ? self->ldap : NULL; > ----------------------------------------------------------------------=20= > --- > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get the chance to =20 > share your > opinions on IT & business topics through brief surveys -- and earn =20 > cash > http://www.techsay.com/default.php?=20 > page=3Djoin.php&p=3Dsourceforge&CID=3DDEVDEV____________________________= ____=20 > _______________ > Python-LDAP-dev mailing list > Pyt...@li... > https://lists.sourceforge.net/lists/listinfo/python-ldap-dev |
From: <mi...@st...> - 2006-09-19 05:16:54
|
Keith Jackson wrote: > 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. Yes, it is. I already checked the code with it. But mainly it does only search for function names of the C API. I also don't have a 64-bit machine at hand with decent tool chain. So I won't see compiler warnings on my local system (SuSE Linux 10.0 i386). And in some cases I don't know what to do. E.g. when converting to OpenLDAP's struct berval (handling the length of the berval string). Hmm, to me it looks ok. >From OpenLDAP's lber_types.h: ------------------------------ snip ------------------------------ /* LBER lengths (32 bits or larger) */ #define LBER_LEN_T long [..] /* lengths */ typedef unsigned LBER_LEN_T ber_len_t; ------------------------------ snip ------------------------------ >From OpenLDAP's lber_types.h: ------------------------------ snip ------------------------------ /* structure for returning a sequence of octet strings + length */ typedef struct berval { ber_len_t bv_len; char *bv_val; } BerValue; ------------------------------ snip ------------------------------ Ciao, Michael. |