[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH RFC 20/32] python//qmp.py: assert sockfile is not None
From: |
Philippe Mathieu-Daudé |
Subject: |
Re: [PATCH RFC 20/32] python//qmp.py: assert sockfile is not None |
Date: |
Tue, 26 May 2020 18:03:28 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.5.0 |
On 5/14/20 7:53 AM, John Snow wrote:
> In truth, if you don't do this, you'll just get a TypeError
> exception. Now, you'll get an AssertionError.
>
> Is this tangibly better? No.
> Does mypy complain less? Yes.
>
> Signed-off-by: John Snow <address@hidden>
> ---
> python/qemu/lib/qmp.py | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/python/qemu/lib/qmp.py b/python/qemu/lib/qmp.py
> index 5fb16f4b42..1aefc00c93 100644
> --- a/python/qemu/lib/qmp.py
> +++ b/python/qemu/lib/qmp.py
> @@ -132,6 +132,7 @@ def __negotiate_capabilities(self):
> raise QMPCapabilitiesError
>
> def __json_read(self, only_event=False):
> + assert self.__sockfile is not None
> while True:
> data = self.__sockfile.readline()
> if not data:
>
Acked-by: Philippe Mathieu-Daudé <address@hidden>
- [PATCH RFC 14/32] python//qmp.py: use True/False for non/blocking modes, (continued)
- [PATCH RFC 14/32] python//qmp.py: use True/False for non/blocking modes, John Snow, 2020/05/14
- [PATCH RFC 16/32] python//qmp.py: re-absorb MonitorResponseError, John Snow, 2020/05/14
- [PATCH RFC 15/32] python//qmp.py: Define common types, John Snow, 2020/05/14
- [PATCH RFC 17/32] python//qmp.py: Do not return None from cmd_obj, John Snow, 2020/05/14
- [PATCH RFC 18/32] python//qmp.py: add casts to JSON deserialization, John Snow, 2020/05/14
- [PATCH RFC 20/32] python//qmp.py: assert sockfile is not None, John Snow, 2020/05/14
- [PATCH RFC 21/32] python//machine.py: remove logging configuration, John Snow, 2020/05/14
- [PATCH RFC 22/32] python//machine.py: Fix monitor address typing, John Snow, 2020/05/14
- [PATCH RFC 23/32] python//machine.py: reorder __init__, John Snow, 2020/05/14
- [PATCH RFC 24/32] python//machine.py: Don't modify state in _base_args(), John Snow, 2020/05/14
- [PATCH RFC 25/32] python//machine.py: Handle None events in event_wait, John Snow, 2020/05/14