[libvirt] [PATCH python] Fix virStream.sendAll for Python 3

Xavier Fernandez posted 1 patch 6 years, 11 months ago
Failed in applying to current master (apply log)
libvirt-override-virStream.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[libvirt] [PATCH python] Fix virStream.sendAll for Python 3
Posted by Xavier Fernandez 6 years, 11 months ago
In Python 3, if the file is open in binary mode, ``got`` will end up
being equal to b"" and b"" != "" in Python 3.
---
 libvirt-override-virStream.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libvirt-override-virStream.py b/libvirt-override-virStream.py
index c328154..2e77cc7 100644
--- a/libvirt-override-virStream.py
+++ b/libvirt-override-virStream.py
@@ -83,7 +83,7 @@
                     pass
                 raise e
 
-            if got == "":
+            if not got:
                 break
 
             ret = self.send(got)
-- 
2.12.2

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH python] Fix virStream.sendAll for Python 3
Posted by Martin Kletzander 6 years, 11 months ago
On Fri, May 05, 2017 at 04:39:34PM +0200, Xavier Fernandez wrote:
>In Python 3, if the file is open in binary mode, ``got`` will end up
>being equal to b"" and b"" != "" in Python 3.
>---
> libvirt-override-virStream.py | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>

Makes sense, I also stumbled upon something similar.  ACK and I will
push this in a while, thanks for the patch.  I'll reword the commit
message a tiny bit.

>diff --git a/libvirt-override-virStream.py b/libvirt-override-virStream.py
>index c328154..2e77cc7 100644
>--- a/libvirt-override-virStream.py
>+++ b/libvirt-override-virStream.py
>@@ -83,7 +83,7 @@
>                     pass
>                 raise e
>
>-            if got == "":
>+            if not got:
>                 break
>
>             ret = self.send(got)
>--
>2.12.2
>
>--
>libvir-list mailing list
>libvir-list@redhat.com
>https://www.redhat.com/mailman/listinfo/libvir-list
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH python] Fix virStream.sendAll for Python 3
Posted by Xavier Fernandez 6 years, 11 months ago
Great !
Thanks for the merge and your work :)

Cheers,
Xavier

On Wed, May 17, 2017 at 9:12 AM, Martin Kletzander <mkletzan@redhat.com>
wrote:

> On Fri, May 05, 2017 at 04:39:34PM +0200, Xavier Fernandez wrote:
>
>> In Python 3, if the file is open in binary mode, ``got`` will end up
>> being equal to b"" and b"" != "" in Python 3.
>> ---
>> libvirt-override-virStream.py | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>>
> Makes sense, I also stumbled upon something similar.  ACK and I will
> push this in a while, thanks for the patch.  I'll reword the commit
> message a tiny bit.
>
> diff --git a/libvirt-override-virStream.py b/libvirt-override-virStream.py
>> index c328154..2e77cc7 100644
>> --- a/libvirt-override-virStream.py
>> +++ b/libvirt-override-virStream.py
>> @@ -83,7 +83,7 @@
>>                     pass
>>                 raise e
>>
>> -            if got == "":
>> +            if not got:
>>                 break
>>
>>             ret = self.send(got)
>> --
>> 2.12.2
>>
>> --
>> libvir-list mailing list
>> libvir-list@redhat.com
>> https://www.redhat.com/mailman/listinfo/libvir-list
>>
>
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list