classification
Title: _thread: acquire_lock,release_lock still in use while declared to be "gone" in Documentation
Type: enhancement Stage:
Components: Library (Lib) Versions: Python 3.7
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: docs@python Nosy List: brett.cannon, docs@python, shiyuchong
Priority: normal Keywords:

Created on 2019-07-17 10:23 by shiyuchong, last changed 2019-07-18 02:18 by shiyuchong.

Messages (3)
msg348053 - (view) Author: 徐靖 (shiyuchong) Date: 2019-07-17 10:23
In https://docs.python.org/3/whatsnew/3.0.html#library-changes Documentation, it said "Cleanup of the thread module: acquire_lock() and release_lock() are gone; use acquire() and release() instead."
But in 3.7, I can still find 
{"acquire_lock", (PyCFunction)(void(*)(void))lock_PyThread_acquire_lock,
     METH_VARARGS | METH_KEYWORDS, acquire_doc},
in _threadmodule.c line 217, which defined this function. And in my code ,these functions work, without any warning or error.
So maybe the Documentation should be changed, or the support of these functions should be removed, or at least add a warning.
It has no effect on code, but truly confusing and waste me an hour to search for why.
msg348083 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2019-07-17 22:14
The documentation is correct by not documenting the methods as they are not meant to be used.

A warning could be added, but it requires new code to wrap the C function with a DeprecationWarning since that code is currently shared between thread.LockType.acquire() and acquire_lock().
msg348094 - (view) Author: 徐靖 (shiyuchong) Date: 2019-07-18 02:18
I got it that it is just my misunderstanding.
Thanks.
History
Date User Action Args
2019-07-18 02:18:54shiyuchongsetmessages: + msg348094
2019-07-17 22:14:01brett.cannonsetnosy: + brett.cannon
messages: + msg348083

components: + Library (Lib), - Documentation
type: enhancement
2019-07-17 10:23:49shiyuchongcreate