diff mbox series

[RFC] semanage: use instance check

Message ID 20230807185510.237623-1-cgzones@googlemail.com (mailing list archive)
State Rejected
Delegated to: Petr Lautrbach
Headers show
Series [RFC] semanage: use instance check | expand

Commit Message

Christian Göttsche Aug. 7, 2023, 6:55 p.m. UTC
Please flake8:

    ./python/semanage/seobject.py:250:16: E721 do not compare types, for exact checks use `is` / `is not`, for instance checks use `isinstance()`
Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
---
This currently breaks the GitHub CI.
---
 python/semanage/seobject.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Petr Lautrbach Aug. 8, 2023, 10:30 a.m. UTC | #1
Christian Göttsche <cgzones@googlemail.com> writes:

> Please flake8:
>
>     ./python/semanage/seobject.py:250:16: E721 do not compare types, for exact checks use `is` / `is not`, for instance checks use `isinstance()`
> Signed-off-by: Christian Göttsche <cgzones@googlemail.com>


Thanks, but it's already proposed

https://lore.kernel.org/selinux/20230803134024.20849-1-jwcart2@gmail.com/T/#u


> ---
> This currently breaks the GitHub CI.
> ---
>  python/semanage/seobject.py | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/python/semanage/seobject.py b/python/semanage/seobject.py
> index 361205d1..cc944ae2 100644
> --- a/python/semanage/seobject.py
> +++ b/python/semanage/seobject.py
> @@ -247,7 +247,7 @@ class semanageRecords:
>          global handle
>          if args:
>              # legacy code - args was store originally
> -            if type(args) == str:
> +            if isinstance(args, str):
>                  self.store = args
>              else:
>                  self.args = args
> -- 
> 2.40.1
James Carter Aug. 8, 2023, 6:32 p.m. UTC | #2
On Mon, Aug 7, 2023 at 3:40 PM Christian Göttsche
<cgzones@googlemail.com> wrote:
>
> Please flake8:
>
>     ./python/semanage/seobject.py:250:16: E721 do not compare types, for exact checks use `is` / `is not`, for instance checks use `isinstance()`
> Signed-off-by: Christian Göttsche <cgzones@googlemail.com>

Another patch just like this has been merged.
Thanks,
Jim

> ---
> This currently breaks the GitHub CI.
> ---
>  python/semanage/seobject.py | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/python/semanage/seobject.py b/python/semanage/seobject.py
> index 361205d1..cc944ae2 100644
> --- a/python/semanage/seobject.py
> +++ b/python/semanage/seobject.py
> @@ -247,7 +247,7 @@ class semanageRecords:
>          global handle
>          if args:
>              # legacy code - args was store originally
> -            if type(args) == str:
> +            if isinstance(args, str):
>                  self.store = args
>              else:
>                  self.args = args
> --
> 2.40.1
>
diff mbox series

Patch

diff --git a/python/semanage/seobject.py b/python/semanage/seobject.py
index 361205d1..cc944ae2 100644
--- a/python/semanage/seobject.py
+++ b/python/semanage/seobject.py
@@ -247,7 +247,7 @@  class semanageRecords:
         global handle
         if args:
             # legacy code - args was store originally
-            if type(args) == str:
+            if isinstance(args, str):
                 self.store = args
             else:
                 self.args = args