[PATCH python 12/15] examples: Ensure we write bytes to the self-pipe

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: "Daniel P. Berrange" <berrange@xxxxxxxxxx>

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@xxxxxxxxxx>
---
 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 7fd9867..74c3634 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@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]