Armin Rigo committed 95de727

Fix the docstring (bogus on CPython too, reported). Test the real

Comments (0)

Files changed (2)


     def descr_lock_acquire(self, space, waitflag=1):
-        """Lock the lock.  Without argument, this blocks if the lock is already
-locked (even by the same thread), waiting for another thread to release
-the lock, and return None once the lock is acquired.
-With an argument, this will only block if the argument is true,
+        """Lock the lock.  With the default argument of True, this blocks
+if the lock is already locked (even by the same thread), waiting for
+another thread to release the lock, and returns True once the lock is
+acquired.  With an argument of False, this will always return immediately
 and the return value reflects whether the lock is acquired.
 The blocking operation is not interruptible."""
         mylock = self.lock
 def allocate_lock(space):
     """Create a new lock object.  (allocate() is an obsolete synonym.)
 See LockType.__doc__ for information about locks."""
-    return space.wrap(Lock(space))
+    return space.wrap(Lock(space))


         assert lock.locked() is False
         raises(thread.error, lock.release)
         assert lock.locked() is False
-        lock.acquire()
+        r = lock.acquire()
+        assert r is True
+        r = lock.acquire(False)
+        assert r is False
         assert lock.locked() is True
         assert lock.locked() is False