prserv: remove dead code in exception handling
PATCH 1/1 prserv: remove dead code in exception handling
From: Michael Opdenacker <[email protected]>
As explained in https://docs.python.org/3/reference/compound_stmts.html#else-clause,
the code after the "else" statement won't be run as there is a "return" in the "try" block.
---
See the whole code on
https://git.openembedded.org/bitbake/tree/lib/prserv/serv.py#n38
--- lib/prserv/serv.py | 2 -- 1 file changed, 2 deletions(-)
lib/prserv/serv.py +0 -2
@@ -40,8 +40,6 @@ class PRServerClient(bb.asyncrpc.AsyncServerConnection): except: self.table.sync() raise - else: - self.table.sync_if_dirty() async def handle_get_pr(self, request): version = request['version']
Signature · 1 line
2.34.1
Quoted 22 lines · Michael Opdenacker via lists.openembedded.org
From: Michael Opdenacker <[email protected]>
As explained in https://docs.python.org/3/reference/compound_stmts.html#else-clause,
the code after the "else" statement won't be run as there is a "return" in the "try" block.Signed-off-by Michael Opdenacker <[email protected]>---
See the whole code on
https://git.openembedded.org/bitbake/tree/lib/prserv/serv.py#n38--- lib/prserv/serv.py | 2 -- 1 file changed, 2 deletions(-)lib/prserv/serv.py +0
-0
lib/prserv/serv.py class PRServerClient(bb.asyncrpc.AsyncServerConnection): · line 44
Quoted 5 lines
lib/prserv/serv.py +0
-2@@ -40,8 +40,6 @@ class PRServerClient(bb.asyncrpc.AsyncServerConnection): except: self.table.sync() raise - else: - self.table.sync_if_dirty()
It is correct this will not run, should self.table.sync() be in a finally block instead to make sure the DB is always synced? (the except can also be removed then)
Quoted 15 lines
lib/prserv/serv.py +0
-1async def handle_get_pr(self, request): version = request['version'] --2.34.1
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#15990): https://lists.openembedded.org/g/bitbake-devel/message/15990
Mute This Topic: https://lists.openembedded.org/mt/104770220/3616693
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/bitbake-devel/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-
Hi Joshua
Quoted 19 lines · Joshua Watt
Quoted 16 lines · Michael Opdenacker via lists.openembedded.org
From: Michael Opdenacker <[email protected]>
As explained in https://docs.python.org/3/reference/compound_stmts.html#else-clause,
the code after the "else" statement won't be run as there is a "return" in the "try" block.Signed-off-by Michael Opdenacker <[email protected]>---
See the whole code on
https://git.openembedded.org/bitbake/tree/lib/prserv/serv.py#n38--- lib/prserv/serv.py | 2 -- 1 file changed, 2 deletions(-)
Quoted 13 lines
lib/prserv/serv.py class PRServerClient(bb.asyncrpc.AsyncServerConnection): · line 44
Quoted 10 lines
lib/prserv/serv.py +0
-2@@ -40,8 +40,6 @@ class PRServerClient(bb.asyncrpc.AsyncServerConnection): except: self.table.sync() raise - else: - self.table.sync_if_dirty()It is correct this will not run, should
self.table.sync()be in a finally block instead to make sure the DB is always synced? (the except can also be removed then)
I've implemented this simplification, but it would cause to run "self.table.sync()" even when no exception is caught. That wasn't the case before. Is that what you were suggesting?
Happy to submit my change if you agree!
Cheers
Michael.
Signature · 3 lines
Michael Opdenacker, Bootlin Embedded Linux and Kernel engineering https://bootlin.com