Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 8fdc75b

Browse files
committed
Lock methods acquire() and locked() now return bools.
1 parent 7f7666f commit 8fdc75b

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

Modules/threadmodule.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -68,17 +68,17 @@ lock_PyThread_acquire_lock(lockobject *self, PyObject *args)
6868
return Py_None;
6969
}
7070
else
71-
return PyInt_FromLong((long)i);
71+
return PyBool_FromLong((long)i);
7272
}
7373

7474
static char acquire_doc[] =
75-
"acquire([wait]) -> None or Boolean\n\
75+
"acquire([wait]) -> None or bool\n\
7676
(PyThread_acquire_lock() is an obsolete synonym)\n\
7777
\n\
7878
Lock the lock. Without argument, this blocks if the lock is already\n\
7979
locked (even by the same thread), waiting for another thread to release\n\
80-
the lock, and return None when the lock is acquired.\n\
81-
With a Boolean argument, this will only block if the argument is true,\n\
80+
the lock, and return None once the lock is acquired.\n\
81+
With an argument, this will only block if the argument is true,\n\
8282
and the return value reflects whether the lock is acquired.\n\
8383
The blocking operation is not interruptible.";
8484

@@ -110,13 +110,13 @@ lock_locked_lock(lockobject *self)
110110
{
111111
if (PyThread_acquire_lock(self->lock_lock, 0)) {
112112
PyThread_release_lock(self->lock_lock);
113-
return PyInt_FromLong(0L);
113+
return PyBool_FromLong(0L);
114114
}
115-
return PyInt_FromLong(1L);
115+
return PyBool_FromLong(1L);
116116
}
117117

118118
static char locked_doc[] =
119-
"locked() -> Boolean\n\
119+
"locked() -> bool\n\
120120
(locked_lock() is an obsolete synonym)\n\
121121
\n\
122122
Return whether the lock is in the locked state.";

0 commit comments

Comments
 (0)