result timeout

David Leonard david.leonard at csee.uq.edu.au
Wed Jun 13 02:52:11 CEST 2001


On Tue, 12 Jun 2001, Michael Ströder typed thusly:

> The result() method of current CVS version does not return
> (None,None) as mentioned on
> http://python-ldap.sourceforge.net/doc/lib/node9.html if timeout
> occured. Simply None is returned.

Which should be changed? The code or the documentation?
or should it raise a timeout exception instead?
its not hard to fix... but what to do?

--- LDAPObject.c        2001/06/03 08:11:19     1.10
+++ LDAPObject.c        2001/06/13 00:43:53
@@ -1235,8 +1235,7 @@

     if (res_type == 0) {
        /* Timeout has occured */
-       Py_INCREF(Py_None);
-       return Py_None;
+       return Py_BuildValue("(OO)", Py_None, Py_None);
     }

     /* thanks to Konstantin Chuguev for this */


--- libldap.tex Wed May 16 11:33:00 2001
+++ /tmp/x      Wed Jun 13 10:44:50 2001
@@ -524,7 +524,7 @@
 the method will wait indefinitely for a response.
 The timeout can be expressed as a floating-point value, and
 a value of \constant{0} effects a poll.
-If a timeout does occur, the tuple \constant{(None,None)} is returned.
+If a timeout does occur, \constant{None} is returned.
 (This should really have been a \exception{TIMEOUT} exception!)

 The \method{result()} method returns a tuple of the form

--- LDAPObject.c        2001/06/03 08:11:19     1.10
+++ LDAPObject.c        2001/06/13 00:51:12
@@ -1235,8 +1235,7 @@

     if (res_type == 0) {
        /* Timeout has occured */
-       Py_INCREF(Py_None);
-       return Py_None;
+       return PyErr_SetObject(errobjects[LDAP_TIMEOUT], Py_None);
     }

     /* thanks to Konstantin Chuguev for this */

-- 
David Leonard                           David.Leonard at dstc.edu.au
DSTC                                    Room:78-632  Ph:+61 7 336 58358
The University of Queensland            http://www.dstc.edu.au/
QLD 4072  AUSTRALIA                     B73CD65FBEF4C089B79A8EBADF1A932F13EA0FC8

The entire history of the world is the triumph of the heartless over
the mindless.  - Sir Humphrey Appleby, Yes Minister.






More information about the python-ldap mailing list