[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 07/16] qapi/expr.py: Add casts in a few select cases
From: |
Eduardo Habkost |
Subject: |
Re: [PATCH 07/16] qapi/expr.py: Add casts in a few select cases |
Date: |
Wed, 23 Sep 2020 16:01:02 -0400 |
On Tue, Sep 22, 2020 at 05:13:04PM -0400, John Snow wrote:
> Casts are instructions to the type checker only, they aren't "safe" and
> should probably be avoided in general. In this case, when we perform
> type checking on a nested structure, the type of each field does not
> "stick".
>
> We don't need to assert that something is a str if we've already checked
> that it is -- use a cast instead for these cases.
>
> Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
--
Eduardo
- Re: [PATCH 02/16] qapi/expr.py: Check for dict instead of OrderedDict, (continued)
- [PATCH 05/16] qapi/expr.py: move string check upwards in check_type, John Snow, 2020/09/22
- [PATCH 06/16] qapi/expr.py: Check type of 'data' member, John Snow, 2020/09/22
- [PATCH 07/16] qapi/expr.py: Add casts in a few select cases, John Snow, 2020/09/22
- [PATCH 08/16] qapi/expr.py: add type hint annotations, John Snow, 2020/09/22
- [PATCH 09/16] qapi/expr.py: rewrite check_if, John Snow, 2020/09/22
- [PATCH 10/16] qapi/expr.py: Remove single-letter variable, John Snow, 2020/09/22