[at-spi2-core: 4/30] versioned-introspection.py: Pass the correct encoding to ElementTree.tostring()




commit cdf85072273fb1969980efeb16f210268a4a6d83
Author: Federico Mena Quintero <federico gnome org>
Date:   Mon Jun 27 20:08:55 2022 -0500

    versioned-introspection.py: Pass the correct encoding to ElementTree.tostring()
    
    The default of us-ascii would generate a bytestring, not a Unicode
    string, and later .replace() would throw an exception.

 xml/versioned-introspection.py | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
---
diff --git a/xml/versioned-introspection.py b/xml/versioned-introspection.py
index 3922f661..9ad9c86e 100644
--- a/xml/versioned-introspection.py
+++ b/xml/versioned-introspection.py
@@ -1,4 +1,3 @@
-
 import sys
 from xml.etree import ElementTree
 
@@ -76,7 +75,7 @@ def main (argv):
 
                #Create the introspection string with version information.
                itf.attrib["version"] = VERSION
-               contents = convert_contents (ElementTree.tostring (itf))
+               contents = convert_contents (ElementTree.tostring (itf, encoding="unicode"))
 
                hcontents += DECTEMPLATE % (name)
                ccontents += DEFTEMPLATE % (name, contents)
@@ -88,4 +87,4 @@ def main (argv):
        hfile.close ()  
        
 if __name__ == "__main__":
-       sys.exit(main(sys.argv))
+        main(sys.argv)


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