($INBOX_DIR/description missing)
 help / color / mirror / Atom feed
From: Michael Opdenacker <michael.opdenacker@bootlin.com>
To: Joshua Watt <jpewhacker@gmail.com>
Cc: bitbake-devel@lists.openembedded.org
Subject: Re: [bitbake-devel] [PATCH] prserv: remove dead code in exception handling
Date: Fri, 8 Mar 2024 16:31:06 +0100	[thread overview]
Message-ID: <f7290592-375e-448d-a33d-6c806c6fc36b@bootlin.com> (raw)
In-Reply-To: <CAJdd5GZ1RkHzaFhSmVYZmBsK=z9Y3Sge5d5=-SdsJjneiOp1gg@mail.gmail.com>

Hi Joshua

On 3/7/24 at 00:31, Joshua Watt wrote:
> On Wed, Mar 6, 2024 at 10:12 AM Michael Opdenacker via
> lists.openembedded.org
> <michael.opdenacker=bootlin.com@lists.openembedded.org> wrote:
>> From: Michael Opdenacker <michael.opdenacker@bootlin.com>
>>
>> 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 <michael.opdenacker@bootlin.com>
>>
>> ---
>>
>> 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(-)
>>
>> diff --git a/lib/prserv/serv.py b/lib/prserv/serv.py
>> index 5fc8863f7..5032f7cd7 100644
>> --- a/lib/prserv/serv.py
>> +++ b/lib/prserv/serv.py
>> @@ -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.

-- 
Michael Opdenacker, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com



      reply	other threads:[~2024-03-08 15:31 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-06 17:11 [PATCH] prserv: remove dead code in exception handling michael.opdenacker
2024-03-06 23:31 ` [bitbake-devel] " Joshua Watt
2024-03-08 15:31   ` Michael Opdenacker [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f7290592-375e-448d-a33d-6c806c6fc36b@bootlin.com \
    --to=michael.opdenacker@bootlin.com \
    --cc=bitbake-devel@lists.openembedded.org \
    --cc=jpewhacker@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).