Convert Python bytes to GBytes for input arguments
Submitted by Simon Feltman
Methods which take GBytes as arguments should allow automatic conversion from Python bytes objects (or really anything that implements the Python buffer protocol).
Currently a GBytes object needs manual construction. I assume this is also the case for GByteArray.
from gi.repository import GLib, Gio inbytes = GLib.Bytes.new_take(b'asdf') stream = Gio.MemoryInputStream.new_from_bytes(inbytes)