Bug in LDAPObject.c, l_ldap_result()

Derrick 'dman' Hudson dman at dman.ddts.net
Sat Jun 29 22:29:58 CEST 2002


On Sat, Jun 29, 2002 at 07:54:12PM +0200, Michael Ströder wrote:
| Derrick 'dman' Hudson wrote:
| >
| >I see now :
| >
| >  def search_st(...)
| >-    return self.result(msgid,all=1,timeout=timeout)
| >+    return self.result(msgid,all=1,timeout=timeout)[1]
| >      
| >
| >That's precisely what I kept running into
| 
| Please test it!

Now I have (some more, at least).  I copied async.py from CVS and
backported the patches to LDAPObject.c and ldapobject.py to version
2.0.0pre04 and now web2ldap works great (and faster!).  Re-timing the
maillist.py script I originally posted yields this :

    real    0m0.206s
    user    0m0.070s
    sys     0m0.040s

As crude as time(1) may be, that is clearly better and isn't long
enough to measure with my watch or to show up in top :-).

| This whole stuff with result() is somewhat 
| incomplete anyway since the result type

Looks like your sentence was cut off.


The CVS version of python-ldap doesn't work for me, though.  I had to
change some of the sasl stuff in LDAPObject.c for it to compile, and I
get a SEGV with web2ldap.  (I also changed a couple other minor
details that gcc complained about)  I'll work on that problem later.

 
| >| I guess I will add a derived class for the non-blocking version of 
| >| LDAPObject.result(). So everyone will be free to choose.
| >
| >Isn't that what 'timeout=0' is for?
| 
| Yes. But then the application has to handle that.

Isn't that the purpose of not blocking in the first place?

| The non-blocking version of LDAPObject.result() is the one which
| needed the time.sleep() hack.

The version that was in release 2.0.0pre04 was blocking if all was
true.  It just did the blocking in python/python-ldap instead of in
C/libldap2.

| I will add it to ldapobject.py in a separate class.

I have no complaints with that.
 
| >I also think the C function needs
| >to be modified to treat Py_None as NULL to allow python code to
| >specify a timeout that is indefinitely long.
| 
| IMHO that's done with timeout=-1. Looking at l_ldap_result() in 
| LDAPObject.c it seems to be implemented correctly

Ahh, yeah, that is one suitable convention.  Doesn't
    timeout=None
sound amusingly accurate though?  (in english at least)

-D

-- 

> SELECT * FROM users WHERE clue > 0
0 rows returned
                    (http://www.thinkgeek.com/images/products/zoom/no-clue.jpg)
 
http://dman.ddts.net/~dman/

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 240 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/python-ldap/attachments/20020629/bca4b8cb/attachment.pgp>


More information about the python-ldap mailing list