diff mbox series

[v3,31/47] qapi/gen.py: Fix edge-case of _is_user_module

Message ID 20200925002900.465855-32-jsnow@redhat.com
State Superseded
Headers show
Series qapi: static typing conversion, pt1 | expand

Commit Message

John Snow Sept. 25, 2020, 12:28 a.m. UTC
The edge case is that if the name is '', this expression returns a
string instead of a bool, which violates our declared type.

Signed-off-by: John Snow <jsnow@redhat.com>
---
 scripts/qapi/gen.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Cleber Rosa Sept. 29, 2020, 4:22 a.m. UTC | #1
On Thu, Sep 24, 2020 at 08:28:44PM -0400, John Snow wrote:
> The edge case is that if the name is '', this expression returns a

> string instead of a bool, which violates our declared type.

> 

> Signed-off-by: John Snow <jsnow@redhat.com>


Reviewed-by: Cleber Rosa <crosa@redhat.com>
diff mbox series

Patch

diff --git a/scripts/qapi/gen.py b/scripts/qapi/gen.py
index c1e65f2e52..75471c4cc2 100644
--- a/scripts/qapi/gen.py
+++ b/scripts/qapi/gen.py
@@ -250,7 +250,7 @@  def __init__(self, prefix, what, user_blurb, builtin_blurb, pydoc):
 
     @staticmethod
     def _is_user_module(name):
-        return name and not name.startswith('./')
+        return bool(name and not name.startswith('./'))
 
     @staticmethod
     def _is_builtin_module(name):