-
Will Thompson authored
The main case where this helps is byte strings. GVariant has a special case for values of type 'ay' which end with a NUL byte and otherwise contain only printable ASCII characters: it prints them in the form b'asciistring'. UDisks and Flatpak (among others) use bytestrings of this form extensively for file paths, which are not guaranteed to be UTF-8 so cannot be represented as D-Bus type 's'. This does have the downside that b'foo' is also valid Python but means something different: In [2]: GLib.Variant('ay', b'abc') Out[2]: GLib.Variant('ay', [0x61, 0x62, 0x63]) In [3]: GLib.Variant('ay', b'abc\0') Out[3]: GLib.Variant('ay', b'abc')