Skip to content
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

threading related deprecation fixes for python 3.10 #2028

Closed
wants to merge 2 commits into from

Conversation

graingert
Copy link

@graingert graingert commented Apr 11, 2022

fixes #1838

remake of #1870 with py2.6 support

@@ -80,7 +81,7 @@ def reverse_forward_tunnel(server_port, remote_host, remote_port, transport):
thr = threading.Thread(
target=handler, args=(chan, remote_host, remote_port)
)
thr.setDaemon(True)
set_daemon(thr, True)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Woops I got the description wrong, this is for py2.6 support

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The daemon attribute is available since Python 2.6 and works.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wait only 3.3 needs the old method names? It seems the new way is supported from 2.6+? #1870 (comment)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've confirmed with Python 2.6 and just confirmed now.

$ python2.6
Python 2.6.9 (default, Jul 29 2017, 12:47:14)
[GCC 5.4.0 20160609] on linux4
Type "help", "copyright", "credits" or "license" for more information.
>>> import threading
>>> import time
>>> t = threading.Thread(target=lambda: time.sleep(1000))
>>> t.daemon = True
>>> t.start()
>>> t.is_alive()
True
>>> #=> it is able to exit without no wait

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wait only 3.3 needs the old method names? It seems the new way is supported from 2.6+? #1870 (comment)

I recommend checking documentation. The daemon and notify_all are available on Python 3.0.

@@ -101,7 +101,7 @@ def feed(self, data):
if self._event is not None:
self._event.set()
self._buffer_frombytes(b(data))
self._cv.notifyAll()
notify_all(self._cv)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@graingert
Copy link
Author

graingert commented Apr 12, 2022

This property and method have been supported since 2.6

@graingert graingert closed this Apr 12, 2022
@graingert graingert deleted the threading-deprecation branch April 12, 2022 08:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Threading related deprecations in Python 3.10
2 participants