From e8cf0af3c1b4a2cc541d1fbef07faf6dab7e3559 Mon Sep 17 00:00:00 2001 From: Narendra-Neerukonda Date: Sat, 19 Jun 2021 14:45:57 +0530 Subject: threading related deprecation fixes for python 3.10 --- paramiko/buffered_pipe.py | 4 ++-- paramiko/channel.py | 4 ++-- paramiko/sftp_file.py | 2 +- paramiko/transport.py | 2 +- tests/loop.py | 2 +- tests/test_transport.py | 4 ++-- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/paramiko/buffered_pipe.py b/paramiko/buffered_pipe.py index 69445c97..e8f98714 100644 --- a/paramiko/buffered_pipe.py +++ b/paramiko/buffered_pipe.py @@ -101,7 +101,7 @@ class BufferedPipe(object): if self._event is not None: self._event.set() self._buffer_frombytes(b(data)) - self._cv.notifyAll() + self._cv.notify_all() finally: self._lock.release() @@ -203,7 +203,7 @@ class BufferedPipe(object): self._lock.acquire() try: self._closed = True - self._cv.notifyAll() + self._cv.notify_all() if self._event is not None: self._event.set() finally: diff --git a/paramiko/channel.py b/paramiko/channel.py index 72f65012..5f314361 100644 --- a/paramiko/channel.py +++ b/paramiko/channel.py @@ -1066,7 +1066,7 @@ class Channel(ClosingContextManager): if self.ultra_debug: self._log(DEBUG, "window up {}".format(nbytes)) self.out_window_size += nbytes - self.out_buffer_cv.notifyAll() + self.out_buffer_cv.notify_all() finally: self.lock.release() @@ -1230,7 +1230,7 @@ class Channel(ClosingContextManager): self.closed = True self.in_buffer.close() self.in_stderr_buffer.close() - self.out_buffer_cv.notifyAll() + self.out_buffer_cv.notify_all() # Notify any waiters that we are closed self.event.set() self.status_event.set() diff --git a/paramiko/sftp_file.py b/paramiko/sftp_file.py index 0104d857..57e04175 100644 --- a/paramiko/sftp_file.py +++ b/paramiko/sftp_file.py @@ -527,7 +527,7 @@ class SFTPFile(BufferedFile): self._prefetch_done = False t = threading.Thread(target=self._prefetch_thread, args=(chunks,)) - t.setDaemon(True) + t.daemon = True t.start() def _prefetch_thread(self, chunks): diff --git a/paramiko/transport.py b/paramiko/transport.py index b99b3278..c28c3828 100644 --- a/paramiko/transport.py +++ b/paramiko/transport.py @@ -450,7 +450,7 @@ class Transport(threading.Thread, ClosingContextManager): ) # okay, normal socket-ish flow here... threading.Thread.__init__(self) - self.setDaemon(True) + self.daemon = True self.sock = sock # we set the timeout so we can check self.active periodically to # see if we should bail. socket.timeout exception is never propagated. diff --git a/tests/loop.py b/tests/loop.py index dd1f5a0c..40179a64 100644 --- a/tests/loop.py +++ b/tests/loop.py @@ -81,7 +81,7 @@ class LoopSocket(object): self.__lock.acquire() try: self.__in_buffer += data - self.__cv.notifyAll() + self.__cv.notify_all() finally: self.__lock.release() diff --git a/tests/test_transport.py b/tests/test_transport.py index 77ffd6c1..737ef705 100644 --- a/tests/test_transport.py +++ b/tests/test_transport.py @@ -756,7 +756,7 @@ class TransportTest(unittest.TestCase): threading.Thread.__init__( self, None, None, self.__class__.__name__ ) - self.setDaemon(True) + self.daemon = True self.chan = chan self.iterations = iterations self.done_event = done_event @@ -780,7 +780,7 @@ class TransportTest(unittest.TestCase): threading.Thread.__init__( self, None, None, self.__class__.__name__ ) - self.setDaemon(True) + self.daemon = True self.chan = chan self.done_event = done_event self.watchdog_event = threading.Event() -- cgit v1.2.1 From 3929166413343f0acdba44694da7bf8ee44600bb Mon Sep 17 00:00:00 2001 From: Jeff Forcier Date: Mon, 25 Apr 2022 10:56:07 -0400 Subject: Changelog re #1838, closes #1870 --- sites/www/changelog.rst | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sites/www/changelog.rst b/sites/www/changelog.rst index a7c6b2e6..ea9fbc1c 100644 --- a/sites/www/changelog.rst +++ b/sites/www/changelog.rst @@ -2,6 +2,11 @@ Changelog ========= +- :support:`1838` (via :issue:`1870`/:issue:`2028`) Update ``camelCase`` method + calls against the ``threading`` module to be ``snake_case``; this and related + tweaks should fix some deprecation warnings under Python 3.10. Thanks to + Karthikeyan Singaravelan for the report, ``@Narendra-Neerukonda`` for the + patch, and to Thomas Grainger and Jun Omae for patch workshopping. - :bug:`1964` (via :issue:`2024` as also reported in :issue:`2023`) `~paramiko.pkey.PKey` instances' ``__eq__`` did not have the usual safety guard in place to ensure they were being compared to another ``PKey`` object, -- cgit v1.2.1