All of lore.kernel.org
 help / color / mirror / Atom feed
From: Atsushi Nemoto <atsushi.nemoto@sord.co.jp>
To: jkacur@redhat.com
Cc: linux-rt-users@vger.kernel.org, williams@redhat.com,
	jepler@unpythonic.net
Subject: Re: [PATCH] rteval: Add __contains__ in rtevalConfig
Date: Fri, 30 Jul 2021 14:03:18 +0900 (JST)	[thread overview]
Message-ID: <20210730.140318.1967218651294711984.atsushi.nemoto@sord.co.jp> (raw)
In-Reply-To: <20210730030540.1098438-1-jkacur@redhat.com>

On Thu, 29 Jul 2021 23:05:40 -0400, John Kacur <jkacur@redhat.com> wrote:
> Add the __contains__ function to the rtevalCfgSection class  to make "in"
> function correctly.
> 
> For example in cyclictest.py, self.__cfg is not a dictionary, it is an
> instance of the rtevalCfgSection class, therefore
> key in self.__cfg
> does not work as expected. In order to make sure this is fixed
> everywhere, instead of comparing to self.__cfg.keys() everywhere this is
> used, implement the __contains__ function so that "in" works as
> expected.
> 
> This bug was introduced by the commit fd3b732f714d ("rteval: 2to3
> transformations")
> 
> Reported-by: Atsushi Nemoto <atsushi.nemoto@sord.co.jp>
> Signed-off-by: John Kacur <jkacur@redhat.com>
> Correction
> Suggested-by: Jeff Epler <jepler@unpythonic.net>
> Signed-off-by: John Kacur <jkacur@redhat.com>
> ---
>  rteval/rtevalConfig.py | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/rteval/rtevalConfig.py b/rteval/rtevalConfig.py
> index 578aaa3ab58f..56bbc9ee0de6 100644
> --- a/rteval/rtevalConfig.py
> +++ b/rteval/rtevalConfig.py
> @@ -126,6 +126,8 @@ class rtevalCfgSection:
>              return self.__cfgdata[key]
>          return None
>  
> +    def __contains__(self, key):
> +        return key in self.__cfgdata
>  
>      def items(self):
>          return list(self.__cfgdata.items())
> -- 
> 2.31.1

Thank you for review and correct fix.

---
Atsushi Nemoto

  reply	other threads:[~2021-07-30  5:03 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-30  3:05 [PATCH] rteval: Add __contains__ in rtevalConfig John Kacur
2021-07-30  5:03 ` Atsushi Nemoto [this message]
  -- strict thread matches above, loose matches on Subject: below --
2021-07-29 22:07 John Kacur
2021-07-30  0:54 ` Jeff Epler
2021-07-30  3:04   ` John Kacur

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=20210730.140318.1967218651294711984.atsushi.nemoto@sord.co.jp \
    --to=atsushi.nemoto@sord.co.jp \
    --cc=jepler@unpythonic.net \
    --cc=jkacur@redhat.com \
    --cc=linux-rt-users@vger.kernel.org \
    --cc=williams@redhat.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.