aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarthikeyan Singaravelan <tir.karthi@gmail.com>2022-03-27 16:15:03 +0000
committerKarthikeyan Singaravelan <tir.karthi@gmail.com>2022-03-27 16:15:03 +0000
commit3c8895209bebaef2f1ac47d0fd72dc9479807110 (patch)
treee3125b6ab1e49e175c678225cdee2cc52ccce6c0
parent31fa4807d73ed4eb9891a88a15817b439c4eea2d (diff)
downloadpyserial-3c8895209bebaef2f1ac47d0fd72dc9479807110.tar.gz
Fix threading module related DeprecationWarning.
-rwxr-xr-xexamples/wxTerminal.py6
-rw-r--r--serial/rfc2217.py2
-rw-r--r--serial/urlhandler/protocol_cp2110.py2
-rw-r--r--test/test.py8
4 files changed, 9 insertions, 9 deletions
diff --git a/examples/wxTerminal.py b/examples/wxTerminal.py
index 85e5b33..40bd5d0 100755
--- a/examples/wxTerminal.py
+++ b/examples/wxTerminal.py
@@ -166,13 +166,13 @@ class TerminalFrame(wx.Frame):
# end wxGlade
self.__attach_events() # register events
self.OnPortSettings(None) # call setup dialog on startup, opens port
- if not self.alive.isSet():
+ if not self.alive.is_set():
self.Close()
def StartThread(self):
"""Start the receiver thread"""
self.thread = threading.Thread(target=self.ComPortThread)
- self.thread.setDaemon(1)
+ self.thread.daemon = True
self.alive.set()
self.thread.start()
self.serial.rts = True
@@ -332,7 +332,7 @@ class TerminalFrame(wx.Frame):
Thread that handles the incoming traffic. Does the basic input
transformation (newlines) and generates an SerialRxEvent
"""
- while self.alive.isSet():
+ while self.alive.is_set():
b = self.serial.read(self.serial.in_waiting or 1)
if b:
# newline transformation
diff --git a/serial/rfc2217.py b/serial/rfc2217.py
index 0b5a4eb..12636d4 100644
--- a/serial/rfc2217.py
+++ b/serial/rfc2217.py
@@ -462,7 +462,7 @@ class Serial(SerialBase):
self.is_open = True
self._thread = threading.Thread(target=self._telnet_read_loop)
- self._thread.setDaemon(True)
+ self._thread.daemon = True
self._thread.setName('pySerial RFC 2217 reader thread for {}'.format(self._port))
self._thread.start()
diff --git a/serial/urlhandler/protocol_cp2110.py b/serial/urlhandler/protocol_cp2110.py
index 44ad4eb..ce5b037 100644
--- a/serial/urlhandler/protocol_cp2110.py
+++ b/serial/urlhandler/protocol_cp2110.py
@@ -99,7 +99,7 @@ class Serial(SerialBase):
else:
self.is_open = True
self._thread = threading.Thread(target=self._hid_read_loop)
- self._thread.setDaemon(True)
+ self._thread.daemon = True
self._thread.setName('pySerial CP2110 reader thread for {}'.format(self._port))
self._thread.start()
diff --git a/test/test.py b/test/test.py
index d15702d..e1e56c5 100644
--- a/test/test.py
+++ b/test/test.py
@@ -106,8 +106,8 @@ class SendEvent(threading.Thread):
self.serial.write(b"E")
self.serial.flush()
- def isSet(self):
- return self.x.isSet()
+ def is_set(self):
+ return self.x.is_set()
def stop(self):
self.stopped = 1
@@ -130,8 +130,8 @@ class Test1_Forever(unittest.TestCase):
"""no timeout: after port open, the input buffer must be empty (read).
a character is sent after some time to terminate the test (SendEvent)."""
c = self.s.read(1)
- if not (self.event.isSet() and c == b'E'):
- self.fail("expected marker (evt={!r}, c={!r})".format(self.event.isSet(), c))
+ if not (self.event.is_set() and c == b'E'):
+ self.fail("expected marker (evt={!r}, c={!r})".format(self.event.is_set(), c))
class Test2_Forever(unittest.TestCase):