[libvirt] [PATCH python 02/14] examples: Ensure we write bytes to the self-pipe

Doug Goldstein cardoe at gentoo.org
Mon Dec 9 15:53:54 UTC 2013


On Mon, Dec 9, 2013 at 9:15 AM, Daniel P. Berrange <berrange at redhat.com> wrote:
> From: "Daniel P. Berrange" <berrange at redhat.com>
>
> Strings in python3 default to unicode, so when writing to
> the self-pipe we must be sure to use bytes by calling the
> encode() method.
>
> Signed-off-by: Daniel P. Berrange <berrange at redhat.com>
> ---
>  examples/event-test.py | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/examples/event-test.py b/examples/event-test.py
> index cf1a8b8..1402c04 100644
> --- a/examples/event-test.py
> +++ b/examples/event-test.py
> @@ -236,7 +236,7 @@ class virEventLoopPure:
>      def interrupt(self):
>          if self.runningPoll and not self.pendingWakeup:
>              self.pendingWakeup = True
> -            os.write(self.pipetrick[1], 'c')
> +            os.write(self.pipetrick[1], 'c'.encode("UTF-8"))
>
>
>      # Registers a new file handle 'fd', monitoring  for 'events' (libvirt
> --
> 1.8.3.1
>
> --
> libvir-list mailing list
> libvir-list at redhat.com
> https://www.redhat.com/mailman/listinfo/libvir-list

ACK.

-- 
Doug Goldstein




More information about the libvir-list mailing list