classification
Title: Deprecate camelCase aliases from threading.py
Type: Stage: resolved
Components: Library (Lib) Versions: Python 3.10
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Jelle Zijlstra Nosy List: Jelle Zijlstra, christian.heimes, miss-islington, pitrou, rhettinger, terry.reedy, vstinner, xtreak
Priority: normal Keywords: patch

Created on 2021-04-04 01:01 by Jelle Zijlstra, last changed 2021-04-16 09:50 by vstinner. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 25174 merged Jelle Zijlstra, 2021-04-04 01:08
PR 25361 merged christian.heimes, 2021-04-12 10:19
PR 25432 merged terry.reedy, 2021-04-16 05:45
PR 25433 merged miss-islington, 2021-04-16 06:08
PR 25435 merged terry.reedy, 2021-04-16 06:29
Messages (16)
msg390165 - (view) Author: Jelle Zijlstra (Jelle Zijlstra) * (Python triager) Date: 2021-04-04 01:01
Followup from issue37804: deprecate the remaining camelCase aliases, such as threading.currentThread. PR coming soon.
msg390166 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2021-04-04 01:24
I don't think there is any advantage in doing this. It will just break code that has worked for a very long time.

This is the reason that the logging module wasn't changed to more modern naming conventions.
msg390337 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2021-04-06 14:10
Raymond Hettinger:
> I don't think there is any advantage in doing this. It will just break code that has worked for a very long time.

Do you mean code written for Python 2? Right, it's unfortunate that it became harder to write a single code base working on Python 2 and Python 2. But Python 2 had officially reached end of life in January 2020, and Python 3.0 changed threading method names 13 years ago (2008).

Deprecating and removing aliases are two different things. IMO deprecating is non-controversial, especially because DeprecationWarning is hidden by default.

Removing requires to estimate how many projects are impacted. On the top 4000 PyPI projects, I count 80 projects which still call currentThread() for example: that's significant. Example of projects: Twisted, pyuwsgi, PyQt5_sip, mod_wsgi, mercurial, lockfile, jupyterlab, gevent, etc. I didn't check if these projects call current_thread() on Python 3.

I would suggest to wait until the most popular PyPI projects no longer call deprecated methods before removing them.

I suggest to restrict the PR to deprecatation, and not plan removal yet.
msg390442 - (view) Author: Karthikeyan Singaravelan (xtreak) * (Python committer) Date: 2021-04-07 16:08
Just to add the last time isAlive was removed in favor of is_alive it was significant change enough that several libraries in Fedora packaging Python libraries and other open source code. The GitHub PR shows several projects that were affected and I linked to this PR while filing the fixes to relevant libraries. 

https://github.com/python/cpython/pull/15225

There are still new reports of the isAlive change when people try to upgrade : https://github.com/search?l=Python&o=desc&q=isalive+is%3Aissue&s=updated&state=open&type=Issues

I would request to really weigh in the cost of doing this since at one point this will cause more burden when the aliases have to be removed in future hindering Python upgrades and the change just seems to unify the casing of the method names without helping the user here.
msg390826 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2021-04-12 08:43
New changeset 9825bdfbd5c966abf1f1b7264992d722a94c9613 by Jelle Zijlstra in branch 'master':
bpo-43723: Deprecate camelCase aliases from threading (GH-25174)
https://github.com/python/cpython/commit/9825bdfbd5c966abf1f1b7264992d722a94c9613
msg390833 - (view) Author: Christian Heimes (christian.heimes) * (Python committer) Date: 2021-04-12 10:21
The commit broke my PR https://github.com/python/cpython/pull/25329. You missed a call in asyncio tests.
msg390837 - (view) Author: Christian Heimes (christian.heimes) * (Python committer) Date: 2021-04-12 11:13
New changeset 95bbb331ecb3ef5d05859d90b287cc3d27613c86 by Christian Heimes in branch 'master':
bpo-43723: Fix deprecation error caused by thread.setDaemon() (GH-25361)
https://github.com/python/cpython/commit/95bbb331ecb3ef5d05859d90b287cc3d27613c86
msg390840 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2021-04-12 12:07
Thanks Jelle Zijlstra, I merged your PR! I close issue.

Ok, aliases are now deprecated. If someone wants to actually remove the aliases, I suggest to help all projects still using them to fix their deprecation warnings:
https://bugs.python.org/issue43723#msg390337

For now, I prefer to not schedule the removal. There are too many projects using it. By the way, I'm surprised that this number,  I expected that most projects switched since Python 2.6 :-)


Christian:
> The commit broke my PR https://github.com/python/cpython/pull/25329

Usually, warnings are not treated as errors. Thanks for fixing test_asyncio!
msg390843 - (view) Author: Christian Heimes (christian.heimes) * (Python committer) Date: 2021-04-12 12:20
> Usually, warnings are not treated as errors. Thanks for fixing test_asyncio!

Tests should treat any unhandled deprecation warnings as a test failure.
msg390845 - (view) Author: Karthikeyan Singaravelan (xtreak) * (Python committer) Date: 2021-04-12 12:24
I opened a thread a year back on running tests with -Werror in CI. This issue still pops up when someone runs with -Wall and finds unhandled deprecation warnings.

https://discuss.python.org/t/run-test-suite-with-werror-on-ci/2333
msg390846 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2021-04-12 12:30
> Tests should treat any unhandled deprecation warnings as a test failure.

libregrtest sets a sys.unraisablehook: a test is marked as "failed" if any "unraisable exception" is logged.

libregrtest might use a hook on warnings to do the same: log the warning, but mark the test as failed?

One issue that I had with libregrtest and sys.unraisablehook was that some "unraisable exception" was not logged in buildbot logs. I had to use sys.__stderr__ to ensure that the exception is logged. See regrtest_unraisable_hook() of test.libregrtest.utils.

It would be annoying to get a test marked as "FAILED" if the warning is not visible in logs :-(

---

Using -Werror on some CIs would be another option.
msg390847 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2021-04-12 12:33
Oh by the way, if someone wants to enhance libregrtest / our CI, please open a new issue ;-) I'm not interested so, I didn't open a new issue :-) Someone also once proposed to add a post-commit buildbot using -Werror. It may be enough.
msg391167 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2021-04-16 06:08
New changeset 56c76df6e861322bdff77bfb21e5cd55fbacfad2 by Terry Jan Reedy in branch '3.9':
[3.9] bpo-43723: Revert IDLE doc change (GH-25174)
https://github.com/python/cpython/commit/56c76df6e861322bdff77bfb21e5cd55fbacfad2
msg391169 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2021-04-16 07:01
New changeset b40564727fbe85932e92862e57fc065034d98dbf by Terry Jan Reedy in branch '3.8':
[3.8] bpo-43723: Backport IDLE doc change (GH-25174)
https://github.com/python/cpython/commit/b40564727fbe85932e92862e57fc065034d98dbf
msg391179 - (view) Author: miss-islington (miss-islington) Date: 2021-04-16 09:47
New changeset 582917f8b255801f3c722d89ff2b8d6b17a11590 by Miss Islington (bot) in branch '3.8':
[3.9] bpo-43723: Revert IDLE doc change (GH-25174)
https://github.com/python/cpython/commit/582917f8b255801f3c722d89ff2b8d6b17a11590
msg391180 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2021-04-16 09:50
> New changeset 582917f8b255801f3c722d89ff2b8d6b17a11590 by Miss Islington (bot) in branch '3.8':
> [3.9] bpo-43723: Revert IDLE doc change (GH-25174)

Oh. I didn't notice that https://github.com/python/cpython/commit/b40564727fbe85932e92862e57fc065034d98dbf was already merged.

After being rebased before the merge, https://github.com/python/cpython/commit/582917f8b255801f3c722d89ff2b8d6b17a11590 became an empty change!
History
Date User Action Args
2021-06-24 13:59:45iritkatriellinkissue24203 superseder
2021-04-16 09:50:58vstinnersetmessages: + msg391180
2021-04-16 09:47:59miss-islingtonsetmessages: + msg391179
2021-04-16 07:01:17terry.reedysetmessages: + msg391169
2021-04-16 06:29:41terry.reedysetpull_requests: + pull_request24165
2021-04-16 06:08:30miss-islingtonsetnosy: + miss-islington

pull_requests: + pull_request24164
2021-04-16 06:08:14terry.reedysetmessages: + msg391167
2021-04-16 05:45:42terry.reedysetnosy: + terry.reedy

pull_requests: + pull_request24163
2021-04-12 12:33:24vstinnersetmessages: + msg390847
2021-04-12 12:30:47vstinnersetmessages: + msg390846
2021-04-12 12:24:44xtreaksetmessages: + msg390845
2021-04-12 12:20:17christian.heimessetmessages: + msg390843
2021-04-12 12:07:13vstinnersetstatus: open -> closed
resolution: fixed
messages: + msg390840

stage: patch review -> resolved
2021-04-12 11:13:03christian.heimessetmessages: + msg390837
2021-04-12 10:21:12christian.heimessetmessages: + msg390833
2021-04-12 10:19:28christian.heimessetnosy: + christian.heimes
pull_requests: + pull_request24095
2021-04-12 08:43:01vstinnersetmessages: + msg390826
2021-04-07 16:08:19xtreaksetnosy: + xtreak
messages: + msg390442
2021-04-06 14:10:00vstinnersetnosy: + vstinner
messages: + msg390337
2021-04-04 01:24:34rhettingersetnosy: + rhettinger
messages: + msg390166
2021-04-04 01:08:40Jelle Zijlstrasetkeywords: + patch
stage: patch review
pull_requests: + pull_request23915
2021-04-04 01:01:50Jelle Zijlstracreate