-
-
Notifications
You must be signed in to change notification settings - Fork 30.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bpo-43723: deprecate camelCase aliases from threading #25174
Conversation
The snake_case names have existed since Python 2.6, so there is no reason to keep the old camelCase names around. One similar method, threading.Thread.isAlive, was already removed in Python 3.9 (bpo-37804).
Misc/NEWS.d/next/Library/2021-04-03-18-03-44.bpo-43723.uBhBZS.rst
Outdated
Show resolved
Hide resolved
Misc/NEWS.d/next/Library/2021-04-03-18-03-44.bpo-43723.uBhBZS.rst
Outdated
Show resolved
Hide resolved
The following `threading` methods are now deprecated and should be replaced: | ||
`threading.currentThread` => :func:`threading.current_thread`; | ||
`threading.activeCount` => :func:`threading.active_count`; | ||
`threading.Condition.notifyAll` => :meth:`threading.Condition.notify_all`; | ||
`threading.Event.isSet` => :meth:`threading.Event.is_set`; | ||
`threading.Thread.setName` => :attr:`threading.Thread.name`; | ||
`threading.thread.getName` => :attr:`threading.Thread.name`; | ||
`threading.Thread.isDaemon` => :attr:`threading.Thread.daemon`; | ||
`threading.Thread.setDaemon` => :attr:`threading.Thread.daemon`. | ||
Patch by Jelle Zijlstra. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The following `threading` methods are now deprecated and should be replaced: | |
`threading.currentThread` => :func:`threading.current_thread`; | |
`threading.activeCount` => :func:`threading.active_count`; | |
`threading.Condition.notifyAll` => :meth:`threading.Condition.notify_all`; | |
`threading.Event.isSet` => :meth:`threading.Event.is_set`; | |
`threading.Thread.setName` => :attr:`threading.Thread.name`; | |
`threading.thread.getName` => :attr:`threading.Thread.name`; | |
`threading.Thread.isDaemon` => :attr:`threading.Thread.daemon`; | |
`threading.Thread.setDaemon` => :attr:`threading.Thread.daemon`. | |
Patch by Jelle Zijlstra. | |
The following `threading` methods are now deprecated and should be replaced: | |
* `threading.currentThread` => :func:`threading.current_thread`; | |
* `threading.activeCount` => :func:`threading.active_count`; | |
* `threading.Condition.notifyAll` => :meth:`threading.Condition.notify_all`; | |
* `threading.Event.isSet` => :meth:`threading.Event.is_set`; | |
* `threading.Thread.setName` => :attr:`threading.Thread.name`; | |
* `threading.thread.getName` => :attr:`threading.Thread.name`; | |
* `threading.Thread.isDaemon` => :attr:`threading.Thread.daemon`; | |
* `threading.Thread.setDaemon` => :attr:`threading.Thread.daemon`. | |
Patch by Jelle Zijlstra. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had to do it a little differently to get the markup working and work around python/core-workflow#394.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had to do it a little differently to get the markup working and work around python/core-workflow#394.
If you put each item on a long line, you should not be affected by https://github.com/python/core-workflow/issues/394 no?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
blurb reflows the lines to make them fit into 76 characters, so I have to make each line fit into 76 characters to avoid the bug.
* The following ``threading`` methods are now deprecated: | ||
|
||
* ``threading.currentThread`` => :func:`threading.current_thread` | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It doesn't work without these empty lines?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's right, they all get mushed together into a single line
Doc/library/threading.rst
Outdated
methods and functions in this module in the Python 2.x series are still | ||
supported by this module. | ||
supported by this module for compatibility with Python 2.5 and lower. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would prefer to say "deprecated" somewhere, rather than "still supported".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reworded
Thank you @JelleZijlstra for all updates. The final merged change provides very good explanation on the rationale and also great guidance to fix affected. It's really important to provide good guidance on deprecations, to make developers' life easier. |
Change threading.activeCount to synonym threading.active_count. (cherry picked from commit 56c76df) Co-authored-by: Terry Jan Reedy <[email protected]>
Cherry-picked from 9825bdf
That should have been 'backport', not 'revert' in the titles above. Fixed for 3.8 backport. Sorry for any confusion. |
Thanks for backports @terryjreedy ;-) |
Change threading.activeCount to synonym threading.active_count. (cherry picked from commit 56c76df) Co-authored-by: Terry Jan Reedy <[email protected]>
setDaemon() has been deprecated in favor of setting daemon attribute directly in Python 3.10. See: python/cpython#25174
setDaemon() has been deprecated in favor of setting daemon attribute directly in Python 3.10. See: python/cpython#25174
easy_train.py:316: DeprecationWarning: setDaemon() is deprecated, set the daemon attribute instead thread.setDaemon(True) camelCase methods in threading were deprecated in: python/cpython#25174
easy_train.py:316: DeprecationWarning: setDaemon() is deprecated, set the daemon attribute instead thread.setDaemon(True) camelCase methods in threading were deprecated in: python/cpython#25174
Deprecated in Python 3.10: https://docs.python.org/3/whatsnew/3.10.html#deprecated python/cpython#25174 Fixes warnings like: ...bitbake/lib/bb/ui/uievent.py:68: DeprecationWarning: setDaemon() is deprecated, set the daemon attribute instead self.t.setDaemon(True) (Bitbake rev: ea88be5cb39af86a5bc8a7d151ba65bd12df681f) Signed-off-by: Tim Orling <[email protected]> Signed-off-by: Richard Purdie <[email protected]>
Deprecated in Python 3.10: https://docs.python.org/3/whatsnew/3.10.html#deprecated python/cpython#25174 Fixes warnings like: ...bitbake/lib/bb/ui/uievent.py:68: DeprecationWarning: setDaemon() is deprecated, set the daemon attribute instead self.t.setDaemon(True) Signed-off-by: Tim Orling <[email protected]> Signed-off-by: Richard Purdie <[email protected]>
Deprecated in Python 3.10: https://docs.python.org/3/whatsnew/3.10.html#deprecated python/cpython#25174 Fixes warnings like: ...bitbake/lib/bb/ui/uievent.py:68: DeprecationWarning: setDaemon() is deprecated, set the daemon attribute instead self.t.setDaemon(True) (Bitbake rev: ea88be5cb39af86a5bc8a7d151ba65bd12df681f) Signed-off-by: Tim Orling <[email protected]> Signed-off-by: Richard Purdie <[email protected]>
Deprecated in Python 3.10: https://docs.python.org/3/whatsnew/3.10.html#deprecated python/cpython#25174 Fixes warnings like: ...bitbake/lib/bb/ui/uievent.py:68: DeprecationWarning: setDaemon() is deprecated, set the daemon attribute instead self.t.setDaemon(True) (Bitbake rev: ea88be5cb39af86a5bc8a7d151ba65bd12df681f) Signed-off-by: Tim Orling <[email protected]> Signed-off-by: Richard Purdie <[email protected]>
Deprecated in Python 3.10: https://docs.python.org/3/whatsnew/3.10.html#deprecated python/cpython#25174 Fixes warnings like: ...bitbake/lib/bb/ui/uievent.py:68: DeprecationWarning: setDaemon() is deprecated, set the daemon attribute instead self.t.setDaemon(True) (Bitbake rev: 17e1b37974ab23a9210a264b0f48dc4812aa75af) Signed-off-by: Tim Orling <[email protected]> Signed-off-by: Richard Purdie <[email protected]> Signed-off-by: Alexandre Belloni <[email protected]>
Deprecated in Python 3.10: https://docs.python.org/3/whatsnew/3.10.html#deprecated python/cpython#25174 Fixes warnings like: ...bitbake/lib/bb/ui/uievent.py:68: DeprecationWarning: setDaemon() is deprecated, set the daemon attribute instead self.t.setDaemon(True) (Bitbake rev: 323f6ce27a1bfd7159e72f29684674ff495dedee) Signed-off-by: Tim Orling <[email protected]> Signed-off-by: Richard Purdie <[email protected]>
Deprecated in Python 3.10: https://docs.python.org/3/whatsnew/3.10.html#deprecated python/cpython#25174 Fixes warnings like: ...bitbake/lib/bb/ui/uievent.py:68: DeprecationWarning: setDaemon() is deprecated, set the daemon attribute instead self.t.setDaemon(True) Signed-off-by: Tim Orling <[email protected]> Signed-off-by: Richard Purdie <[email protected]>
Deprecated in Python 3.10: https://docs.python.org/3/whatsnew/3.10.html#deprecated python/cpython#25174 Fixes warnings like: ...bitbake/lib/bb/ui/uievent.py:68: DeprecationWarning: setDaemon() is deprecated, set the daemon attribute instead self.t.setDaemon(True) (Bitbake rev: 17e1b37974ab23a9210a264b0f48dc4812aa75af) Signed-off-by: Tim Orling <[email protected]> Signed-off-by: Richard Purdie <[email protected]> Signed-off-by: Alexandre Belloni <[email protected]>
setDaemon was deprecated in python/cpython#25174 Fixes: ``` >>> test_tls_server("ECDHE-RSA-AES128-SHA", "-tls1") Traceback (most recent call last): File "<input>", line 2, in <module> File "<input>", line 9, in test_tls_server File "/usr/lib64/python3.11/threading.py", line 1240, in setDaemon warnings.warn('setDaemon() is deprecated, set the daemon attribute instead', DeprecationWarning: setDaemon() is deprecated, set the daemon attribute instead ```
setDaemon was deprecated in python/cpython#25174 Fixes: ``` >>> test_tls_server("ECDHE-RSA-AES128-SHA", "-tls1") Traceback (most recent call last): File "<input>", line 2, in <module> File "<input>", line 9, in test_tls_server File "/usr/lib64/python3.11/threading.py", line 1240, in setDaemon warnings.warn('setDaemon() is deprecated, set the daemon attribute instead', DeprecationWarning: setDaemon() is deprecated, set the daemon attribute instead ```
- Support [deprecation](https://peps.python.org/pep-0632/) of distutils for setuptools > 60. - We can't switch to `packaging.version.parse` because many TK components depend of `distutils.version.LooseVersion`. To handle the distutils deprecation, we're switching to the bundled version living on setuptools >= 60. The deprecation warning is still there, so we're suppressing just this one. - Re-enable commented tests - Support [deprecation](python/cpython#25174) of `isSet()` - Upgrade python-api v3.4.0
The threading camel case methods were deprecated in [1]. A previous pyserial PR [2] fixed a bunch of these warnings, but missed a few. Fix the remaining setName() DeprecationWarnings by using the appropriate name attribute instead. [1] python/cpython#25174 [2] pyserial#643 Signed-off-by: Bastian Krause <[email protected]>
Deprecated in Python 3.10: https://docs.python.org/3/whatsnew/3.10.html#deprecated python/cpython#25174 Fixes warnings like: ...bitbake/lib/bb/ui/uievent.py:68: DeprecationWarning: setDaemon() is deprecated, set the daemon attribute instead self.t.setDaemon(True) (Bitbake rev: 323f6ce27a1bfd7159e72f29684674ff495dedee) Signed-off-by: Tim Orling <[email protected]> Signed-off-by: Richard Purdie <[email protected]>
This method was deprecated in Python 3.10, set the Thread.daemon attribute directly instead. See: python/cpython#25174
This method was deprecated in Python 3.10, set the Thread.daemon attribute directly instead. See: python/cpython#25174
The snake_case names have existed since Python 2.6, so there is
no reason to keep the old camelCase names around. One similar
method, threading.Thread.isAlive, was already removed in
Python 3.9 (bpo-37804).
https://bugs.python.org/issue43723