Message ID | 20230913104636.2554987-1-alexander.zeijlon@cendio.se (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | Stop using deprecated thread.setDaemon | expand |
Adding Calum Mackay.--b. On Wed, Sep 13, 2023 at 12:46:36PM +0200, Alexander Zeijlon wrote: > The thread.setDaemon method is deprecated since Python version 3.10, the > daemon property should now be set directly. > > Signed-off-by: Alexander Zeijlon <alexander.zeijlon@cendio.se> > --- > nfs4.0/nfs4lib.py | 2 +- > nfs4.0/servertests/st_delegation.py | 4 ++-- > nfs4.1/nfs4state.py | 2 +- > rpc/rpc.py | 4 ++-- > 4 files changed, 6 insertions(+), 6 deletions(-) > > diff --git a/nfs4.0/nfs4lib.py b/nfs4.0/nfs4lib.py > index 9b074f0..9a72ec9 100644 > --- a/nfs4.0/nfs4lib.py > +++ b/nfs4.0/nfs4lib.py > @@ -297,7 +297,7 @@ class NFS4Client(rpc.RPCClient): > # Start up callback server associated with this client > self.cb_server = CBServer(self) > self.thread = threading.Thread(target=self.cb_server.run, name=name) > - self.thread.setDaemon(True) > + self.thread.daemon = True > self.thread.start() > # Establish callback control socket > self.cb_control = socket.socket(socket.AF_INET, socket.SOCK_STREAM) > diff --git a/nfs4.0/servertests/st_delegation.py b/nfs4.0/servertests/st_delegation.py > index ba49cf9..bcc768a 100644 > --- a/nfs4.0/servertests/st_delegation.py > +++ b/nfs4.0/servertests/st_delegation.py > @@ -40,7 +40,7 @@ def _recall(c, thisop, cbid): > if res is not None and res.status != NFS4_OK: > t_error = _handle_error(c, res, ops) > t = threading.Thread(target=t_error.run) > - t.setDaemon(1) > + t.daemon = True > t.start() > return res > > @@ -409,7 +409,7 @@ def testChangeDeleg(t, env, funct=_recall): > new_server = CBServer(c) > new_server.set_cb_recall(c.cbid, funct, NFS4_OK); > cb_thread = threading.Thread(target=new_server.run) > - cb_thread.setDaemon(1) > + cb_thread.daemon = True > cb_thread.start() > c.cb_server = new_server > env.sleep(3) > diff --git a/nfs4.1/nfs4state.py b/nfs4.1/nfs4state.py > index e57b90a..6b4cc81 100644 > --- a/nfs4.1/nfs4state.py > +++ b/nfs4.1/nfs4state.py > @@ -308,7 +308,7 @@ class DelegState(FileStateTyped): > e.status = CB_INIT > t = threading.Thread(target=e.initiate_recall, > args=(dispatcher,)) > - t.setDaemon(True) > + t.daemon = True > t.start() > # We need to release the lock so that delegations can be recalled, > # which can involve operations like WRITE, LOCK, OPEN, etc, > diff --git a/rpc/rpc.py b/rpc/rpc.py > index 1fe285a..3621c8e 100644 > --- a/rpc/rpc.py > +++ b/rpc/rpc.py > @@ -598,7 +598,7 @@ class ConnectionHandler(object): > log_p.log(5, "Received record from %i" % fd) > log_p.log(2, repr(r)) > t = threading.Thread(target=self._event_rpc_record, args=(r, s)) > - t.setDaemon(True) > + t.daemon = True > t.start() > > def _event_rpc_record(self, record, pipe): > @@ -935,7 +935,7 @@ class Client(ConnectionHandler): > > # Start polling > t = threading.Thread(target=self.start, name="PollingThread") > - t.setDaemon(True) > + t.daemon = True > t.start() > > def send_call(self, pipe, procedure, data=b'', credinfo=None, > -- > 2.41.0
On 13/09/2023 11:46 am, Alexander Zeijlon wrote: > The thread.setDaemon method is deprecated since Python version 3.10, the > daemon property should now be set directly. Thanks Alexander, I'll add this to my list. cheers, calum. > > Signed-off-by: Alexander Zeijlon <alexander.zeijlon@cendio.se> > --- > nfs4.0/nfs4lib.py | 2 +- > nfs4.0/servertests/st_delegation.py | 4 ++-- > nfs4.1/nfs4state.py | 2 +- > rpc/rpc.py | 4 ++-- > 4 files changed, 6 insertions(+), 6 deletions(-) > > diff --git a/nfs4.0/nfs4lib.py b/nfs4.0/nfs4lib.py > index 9b074f0..9a72ec9 100644 > --- a/nfs4.0/nfs4lib.py > +++ b/nfs4.0/nfs4lib.py > @@ -297,7 +297,7 @@ class NFS4Client(rpc.RPCClient): > # Start up callback server associated with this client > self.cb_server = CBServer(self) > self.thread = threading.Thread(target=self.cb_server.run, name=name) > - self.thread.setDaemon(True) > + self.thread.daemon = True > self.thread.start() > # Establish callback control socket > self.cb_control = socket.socket(socket.AF_INET, socket.SOCK_STREAM) > diff --git a/nfs4.0/servertests/st_delegation.py b/nfs4.0/servertests/st_delegation.py > index ba49cf9..bcc768a 100644 > --- a/nfs4.0/servertests/st_delegation.py > +++ b/nfs4.0/servertests/st_delegation.py > @@ -40,7 +40,7 @@ def _recall(c, thisop, cbid): > if res is not None and res.status != NFS4_OK: > t_error = _handle_error(c, res, ops) > t = threading.Thread(target=t_error.run) > - t.setDaemon(1) > + t.daemon = True > t.start() > return res > > @@ -409,7 +409,7 @@ def testChangeDeleg(t, env, funct=_recall): > new_server = CBServer(c) > new_server.set_cb_recall(c.cbid, funct, NFS4_OK); > cb_thread = threading.Thread(target=new_server.run) > - cb_thread.setDaemon(1) > + cb_thread.daemon = True > cb_thread.start() > c.cb_server = new_server > env.sleep(3) > diff --git a/nfs4.1/nfs4state.py b/nfs4.1/nfs4state.py > index e57b90a..6b4cc81 100644 > --- a/nfs4.1/nfs4state.py > +++ b/nfs4.1/nfs4state.py > @@ -308,7 +308,7 @@ class DelegState(FileStateTyped): > e.status = CB_INIT > t = threading.Thread(target=e.initiate_recall, > args=(dispatcher,)) > - t.setDaemon(True) > + t.daemon = True > t.start() > # We need to release the lock so that delegations can be recalled, > # which can involve operations like WRITE, LOCK, OPEN, etc, > diff --git a/rpc/rpc.py b/rpc/rpc.py > index 1fe285a..3621c8e 100644 > --- a/rpc/rpc.py > +++ b/rpc/rpc.py > @@ -598,7 +598,7 @@ class ConnectionHandler(object): > log_p.log(5, "Received record from %i" % fd) > log_p.log(2, repr(r)) > t = threading.Thread(target=self._event_rpc_record, args=(r, s)) > - t.setDaemon(True) > + t.daemon = True > t.start() > > def _event_rpc_record(self, record, pipe): > @@ -935,7 +935,7 @@ class Client(ConnectionHandler): > > # Start polling > t = threading.Thread(target=self.start, name="PollingThread") > - t.setDaemon(True) > + t.daemon = True > t.start() > > def send_call(self, pipe, procedure, data=b'', credinfo=None,
Thank you! // Alex On 9/13/23 18:32, Calum Mackay wrote: > On 13/09/2023 11:46 am, Alexander Zeijlon wrote: >> The thread.setDaemon method is deprecated since Python version 3.10, the >> daemon property should now be set directly. > > Thanks Alexander, I'll add this to my list. > > cheers, > calum. > >> >> Signed-off-by: Alexander Zeijlon <alexander.zeijlon@cendio.se> >> --- >> nfs4.0/nfs4lib.py | 2 +- >> nfs4.0/servertests/st_delegation.py | 4 ++-- >> nfs4.1/nfs4state.py | 2 +- >> rpc/rpc.py | 4 ++-- >> 4 files changed, 6 insertions(+), 6 deletions(-) >> >> diff --git a/nfs4.0/nfs4lib.py b/nfs4.0/nfs4lib.py >> index 9b074f0..9a72ec9 100644 >> --- a/nfs4.0/nfs4lib.py >> +++ b/nfs4.0/nfs4lib.py >> @@ -297,7 +297,7 @@ class NFS4Client(rpc.RPCClient): >> # Start up callback server associated with this client >> self.cb_server = CBServer(self) >> self.thread = threading.Thread(target=self.cb_server.run, >> name=name) >> - self.thread.setDaemon(True) >> + self.thread.daemon = True >> self.thread.start() >> # Establish callback control socket >> self.cb_control = socket.socket(socket.AF_INET, >> socket.SOCK_STREAM) >> diff --git a/nfs4.0/servertests/st_delegation.py >> b/nfs4.0/servertests/st_delegation.py >> index ba49cf9..bcc768a 100644 >> --- a/nfs4.0/servertests/st_delegation.py >> +++ b/nfs4.0/servertests/st_delegation.py >> @@ -40,7 +40,7 @@ def _recall(c, thisop, cbid): >> if res is not None and res.status != NFS4_OK: >> t_error = _handle_error(c, res, ops) >> t = threading.Thread(target=t_error.run) >> - t.setDaemon(1) >> + t.daemon = True >> t.start() >> return res >> @@ -409,7 +409,7 @@ def testChangeDeleg(t, env, funct=_recall): >> new_server = CBServer(c) >> new_server.set_cb_recall(c.cbid, funct, NFS4_OK); >> cb_thread = threading.Thread(target=new_server.run) >> - cb_thread.setDaemon(1) >> + cb_thread.daemon = True >> cb_thread.start() >> c.cb_server = new_server >> env.sleep(3) >> diff --git a/nfs4.1/nfs4state.py b/nfs4.1/nfs4state.py >> index e57b90a..6b4cc81 100644 >> --- a/nfs4.1/nfs4state.py >> +++ b/nfs4.1/nfs4state.py >> @@ -308,7 +308,7 @@ class DelegState(FileStateTyped): >> e.status = CB_INIT >> t = threading.Thread(target=e.initiate_recall, >> args=(dispatcher,)) >> - t.setDaemon(True) >> + t.daemon = True >> t.start() >> # We need to release the lock so that delegations can be >> recalled, >> # which can involve operations like WRITE, LOCK, OPEN, etc, >> diff --git a/rpc/rpc.py b/rpc/rpc.py >> index 1fe285a..3621c8e 100644 >> --- a/rpc/rpc.py >> +++ b/rpc/rpc.py >> @@ -598,7 +598,7 @@ class ConnectionHandler(object): >> log_p.log(5, "Received record from %i" % fd) >> log_p.log(2, repr(r)) >> t = threading.Thread(target=self._event_rpc_record, >> args=(r, s)) >> - t.setDaemon(True) >> + t.daemon = True >> t.start() >> def _event_rpc_record(self, record, pipe): >> @@ -935,7 +935,7 @@ class Client(ConnectionHandler): >> # Start polling >> t = threading.Thread(target=self.start, name="PollingThread") >> - t.setDaemon(True) >> + t.daemon = True >> t.start() >> def send_call(self, pipe, procedure, data=b'', credinfo=None, >
Hi again, I've fixed a couple more deprecation warnings. See attached patch. BR, Alex On 9/13/23 18:32, Calum Mackay wrote: > On 13/09/2023 11:46 am, Alexander Zeijlon wrote: >> The thread.setDaemon method is deprecated since Python version 3.10, the >> daemon property should now be set directly. > > Thanks Alexander, I'll add this to my list. > > cheers, > calum. > >> >> Signed-off-by: Alexander Zeijlon <alexander.zeijlon@cendio.se> >> --- >> nfs4.0/nfs4lib.py | 2 +- >> nfs4.0/servertests/st_delegation.py | 4 ++-- >> nfs4.1/nfs4state.py | 2 +- >> rpc/rpc.py | 4 ++-- >> 4 files changed, 6 insertions(+), 6 deletions(-) >> >> diff --git a/nfs4.0/nfs4lib.py b/nfs4.0/nfs4lib.py >> index 9b074f0..9a72ec9 100644 >> --- a/nfs4.0/nfs4lib.py >> +++ b/nfs4.0/nfs4lib.py >> @@ -297,7 +297,7 @@ class NFS4Client(rpc.RPCClient): >> # Start up callback server associated with this client >> self.cb_server = CBServer(self) >> self.thread = threading.Thread(target=self.cb_server.run, >> name=name) >> - self.thread.setDaemon(True) >> + self.thread.daemon = True >> self.thread.start() >> # Establish callback control socket >> self.cb_control = socket.socket(socket.AF_INET, >> socket.SOCK_STREAM) >> diff --git a/nfs4.0/servertests/st_delegation.py >> b/nfs4.0/servertests/st_delegation.py >> index ba49cf9..bcc768a 100644 >> --- a/nfs4.0/servertests/st_delegation.py >> +++ b/nfs4.0/servertests/st_delegation.py >> @@ -40,7 +40,7 @@ def _recall(c, thisop, cbid): >> if res is not None and res.status != NFS4_OK: >> t_error = _handle_error(c, res, ops) >> t = threading.Thread(target=t_error.run) >> - t.setDaemon(1) >> + t.daemon = True >> t.start() >> return res >> @@ -409,7 +409,7 @@ def testChangeDeleg(t, env, funct=_recall): >> new_server = CBServer(c) >> new_server.set_cb_recall(c.cbid, funct, NFS4_OK); >> cb_thread = threading.Thread(target=new_server.run) >> - cb_thread.setDaemon(1) >> + cb_thread.daemon = True >> cb_thread.start() >> c.cb_server = new_server >> env.sleep(3) >> diff --git a/nfs4.1/nfs4state.py b/nfs4.1/nfs4state.py >> index e57b90a..6b4cc81 100644 >> --- a/nfs4.1/nfs4state.py >> +++ b/nfs4.1/nfs4state.py >> @@ -308,7 +308,7 @@ class DelegState(FileStateTyped): >> e.status = CB_INIT >> t = threading.Thread(target=e.initiate_recall, >> args=(dispatcher,)) >> - t.setDaemon(True) >> + t.daemon = True >> t.start() >> # We need to release the lock so that delegations can be >> recalled, >> # which can involve operations like WRITE, LOCK, OPEN, etc, >> diff --git a/rpc/rpc.py b/rpc/rpc.py >> index 1fe285a..3621c8e 100644 >> --- a/rpc/rpc.py >> +++ b/rpc/rpc.py >> @@ -598,7 +598,7 @@ class ConnectionHandler(object): >> log_p.log(5, "Received record from %i" % fd) >> log_p.log(2, repr(r)) >> t = threading.Thread(target=self._event_rpc_record, >> args=(r, s)) >> - t.setDaemon(True) >> + t.daemon = True >> t.start() >> def _event_rpc_record(self, record, pipe): >> @@ -935,7 +935,7 @@ class Client(ConnectionHandler): >> # Start polling >> t = threading.Thread(target=self.start, name="PollingThread") >> - t.setDaemon(True) >> + t.daemon = True >> t.start() >> def send_call(self, pipe, procedure, data=b'', credinfo=None, >
On 15/09/2023 12:36 pm, Alexander Zeijlon wrote: > Hi again, > > I've fixed a couple more deprecation warnings. See attached patch. > > BR, > Alex thanks again Alex. cheers, calum. > > On 9/13/23 18:32, Calum Mackay wrote: >> On 13/09/2023 11:46 am, Alexander Zeijlon wrote: >>> The thread.setDaemon method is deprecated since Python version 3.10, the >>> daemon property should now be set directly. >> >> Thanks Alexander, I'll add this to my list. >> >> cheers, >> calum. >> >>> >>> Signed-off-by: Alexander Zeijlon <alexander.zeijlon@cendio.se> >>> --- >>> nfs4.0/nfs4lib.py | 2 +- >>> nfs4.0/servertests/st_delegation.py | 4 ++-- >>> nfs4.1/nfs4state.py | 2 +- >>> rpc/rpc.py | 4 ++-- >>> 4 files changed, 6 insertions(+), 6 deletions(-) >>> >>> diff --git a/nfs4.0/nfs4lib.py b/nfs4.0/nfs4lib.py >>> index 9b074f0..9a72ec9 100644 >>> --- a/nfs4.0/nfs4lib.py >>> +++ b/nfs4.0/nfs4lib.py >>> @@ -297,7 +297,7 @@ class NFS4Client(rpc.RPCClient): >>> # Start up callback server associated with this client >>> self.cb_server = CBServer(self) >>> self.thread = threading.Thread(target=self.cb_server.run, >>> name=name) >>> - self.thread.setDaemon(True) >>> + self.thread.daemon = True >>> self.thread.start() >>> # Establish callback control socket >>> self.cb_control = socket.socket(socket.AF_INET, >>> socket.SOCK_STREAM) >>> diff --git a/nfs4.0/servertests/st_delegation.py b/nfs4.0/ >>> servertests/st_delegation.py >>> index ba49cf9..bcc768a 100644 >>> --- a/nfs4.0/servertests/st_delegation.py >>> +++ b/nfs4.0/servertests/st_delegation.py >>> @@ -40,7 +40,7 @@ def _recall(c, thisop, cbid): >>> if res is not None and res.status != NFS4_OK: >>> t_error = _handle_error(c, res, ops) >>> t = threading.Thread(target=t_error.run) >>> - t.setDaemon(1) >>> + t.daemon = True >>> t.start() >>> return res >>> @@ -409,7 +409,7 @@ def testChangeDeleg(t, env, funct=_recall): >>> new_server = CBServer(c) >>> new_server.set_cb_recall(c.cbid, funct, NFS4_OK); >>> cb_thread = threading.Thread(target=new_server.run) >>> - cb_thread.setDaemon(1) >>> + cb_thread.daemon = True >>> cb_thread.start() >>> c.cb_server = new_server >>> env.sleep(3) >>> diff --git a/nfs4.1/nfs4state.py b/nfs4.1/nfs4state.py >>> index e57b90a..6b4cc81 100644 >>> --- a/nfs4.1/nfs4state.py >>> +++ b/nfs4.1/nfs4state.py >>> @@ -308,7 +308,7 @@ class DelegState(FileStateTyped): >>> e.status = CB_INIT >>> t = threading.Thread(target=e.initiate_recall, >>> args=(dispatcher,)) >>> - t.setDaemon(True) >>> + t.daemon = True >>> t.start() >>> # We need to release the lock so that delegations can be >>> recalled, >>> # which can involve operations like WRITE, LOCK, OPEN, etc, >>> diff --git a/rpc/rpc.py b/rpc/rpc.py >>> index 1fe285a..3621c8e 100644 >>> --- a/rpc/rpc.py >>> +++ b/rpc/rpc.py >>> @@ -598,7 +598,7 @@ class ConnectionHandler(object): >>> log_p.log(5, "Received record from %i" % fd) >>> log_p.log(2, repr(r)) >>> t = threading.Thread(target=self._event_rpc_record, >>> args=(r, s)) >>> - t.setDaemon(True) >>> + t.daemon = True >>> t.start() >>> def _event_rpc_record(self, record, pipe): >>> @@ -935,7 +935,7 @@ class Client(ConnectionHandler): >>> # Start polling >>> t = threading.Thread(target=self.start, name="PollingThread") >>> - t.setDaemon(True) >>> + t.daemon = True >>> t.start() >>> def send_call(self, pipe, procedure, data=b'', credinfo=None, >>
diff --git a/nfs4.0/nfs4lib.py b/nfs4.0/nfs4lib.py index 9b074f0..9a72ec9 100644 --- a/nfs4.0/nfs4lib.py +++ b/nfs4.0/nfs4lib.py @@ -297,7 +297,7 @@ class NFS4Client(rpc.RPCClient): # Start up callback server associated with this client self.cb_server = CBServer(self) self.thread = threading.Thread(target=self.cb_server.run, name=name) - self.thread.setDaemon(True) + self.thread.daemon = True self.thread.start() # Establish callback control socket self.cb_control = socket.socket(socket.AF_INET, socket.SOCK_STREAM) diff --git a/nfs4.0/servertests/st_delegation.py b/nfs4.0/servertests/st_delegation.py index ba49cf9..bcc768a 100644 --- a/nfs4.0/servertests/st_delegation.py +++ b/nfs4.0/servertests/st_delegation.py @@ -40,7 +40,7 @@ def _recall(c, thisop, cbid): if res is not None and res.status != NFS4_OK: t_error = _handle_error(c, res, ops) t = threading.Thread(target=t_error.run) - t.setDaemon(1) + t.daemon = True t.start() return res @@ -409,7 +409,7 @@ def testChangeDeleg(t, env, funct=_recall): new_server = CBServer(c) new_server.set_cb_recall(c.cbid, funct, NFS4_OK); cb_thread = threading.Thread(target=new_server.run) - cb_thread.setDaemon(1) + cb_thread.daemon = True cb_thread.start() c.cb_server = new_server env.sleep(3) diff --git a/nfs4.1/nfs4state.py b/nfs4.1/nfs4state.py index e57b90a..6b4cc81 100644 --- a/nfs4.1/nfs4state.py +++ b/nfs4.1/nfs4state.py @@ -308,7 +308,7 @@ class DelegState(FileStateTyped): e.status = CB_INIT t = threading.Thread(target=e.initiate_recall, args=(dispatcher,)) - t.setDaemon(True) + t.daemon = True t.start() # We need to release the lock so that delegations can be recalled, # which can involve operations like WRITE, LOCK, OPEN, etc, diff --git a/rpc/rpc.py b/rpc/rpc.py index 1fe285a..3621c8e 100644 --- a/rpc/rpc.py +++ b/rpc/rpc.py @@ -598,7 +598,7 @@ class ConnectionHandler(object): log_p.log(5, "Received record from %i" % fd) log_p.log(2, repr(r)) t = threading.Thread(target=self._event_rpc_record, args=(r, s)) - t.setDaemon(True) + t.daemon = True t.start() def _event_rpc_record(self, record, pipe): @@ -935,7 +935,7 @@ class Client(ConnectionHandler): # Start polling t = threading.Thread(target=self.start, name="PollingThread") - t.setDaemon(True) + t.daemon = True t.start() def send_call(self, pipe, procedure, data=b'', credinfo=None,
The thread.setDaemon method is deprecated since Python version 3.10, the daemon property should now be set directly. Signed-off-by: Alexander Zeijlon <alexander.zeijlon@cendio.se> --- nfs4.0/nfs4lib.py | 2 +- nfs4.0/servertests/st_delegation.py | 4 ++-- nfs4.1/nfs4state.py | 2 +- rpc/rpc.py | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-)