This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author terry.reedy
Recipients docs@python, nailor, terry.reedy
Date 2011-01-01.00:37:39
SpamBayes Score 8.254508e-13
Marked as misclassified No
Message-id <>
Since threading is written in Python, one might expect Lock to be written in Python and its methods to accept keywords. However, (3.2) has
  _acquire_lock = _thread.acquire_lock
  Lock = _aquire_lock
so threading.Lock objects are C-coded _thread.lock objects and hence *might* not accept keyword args.

In 3.1:
lock.acquire([waitflag]) # same 2.7
Lock.acquire(blocking=True) # [blocking=1] in 2.7
Indeed the first is correct.

>>> from threading import Lock
>>> l=Lock()
>>> l.acquire(blocking=True)
Traceback (most recent call last):
  File "<pyshell#2>", line 1, in <module>
TypeError: acquire() takes no keyword arguments
>>> l.acquire(True)

r87596, r87596

In 3.2:
lock.acquire(waitflag=1, timeout=-1) 
Lock.acquire(blocking=True, timeout=-1)
The edit in 3.2 is actually correct 

>>> from threading import Lock
>>> l=Lock()
>>> l.acquire(blocking=True)
>>> l.acquire(timeout=1)

_thread.lock.acquire now accepts keywords.
Date User Action Args
2011-01-01 00:37:41terry.reedysetrecipients: + terry.reedy, docs@python, nailor
2011-01-01 00:37:41terry.reedysetmessageid: <>
2011-01-01 00:37:39terry.reedylinkissue10789 messages
2011-01-01 00:37:39terry.reedycreate