Skip to content

Commit e879452

Browse files
committed
threading.RLock._acquire_restore() now raises a TypeError instead of a
SystemError when it is not called with 2 arguments
1 parent f4c68db commit e879452

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

‎Modules/_threadmodule.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -379,13 +379,13 @@ current thread, release() needs to be called as many times for the lock\n\
379379
to be available for other threads.");
380380

381381
static PyObject *
382-
rlock_acquire_restore(rlockobject *self, PyObject *arg)
382+
rlock_acquire_restore(rlockobject *self, PyObject *args)
383383
{
384384
long owner;
385385
unsigned long count;
386386
int r = 1;
387387

388-
if (!PyArg_ParseTuple(arg, "kl:_acquire_restore", &count, &owner))
388+
if (!PyArg_ParseTuple(args, "(kl):_acquire_restore", &count, &owner))
389389
return NULL;
390390

391391
if (!PyThread_acquire_lock(self->rlock_lock, 0)) {
@@ -488,7 +488,7 @@ static PyMethodDef rlock_methods[] = {
488488
{"_is_owned", (PyCFunction)rlock_is_owned,
489489
METH_NOARGS, rlock_is_owned_doc},
490490
{"_acquire_restore", (PyCFunction)rlock_acquire_restore,
491-
METH_O, rlock_acquire_restore_doc},
491+
METH_VARARGS, rlock_acquire_restore_doc},
492492
{"_release_save", (PyCFunction)rlock_release_save,
493493
METH_NOARGS, rlock_release_save_doc},
494494
{"__enter__", (PyCFunction)rlock_acquire,

0 commit comments

Comments
 (0)