GNOME Bugzilla – Bug 113578
Python bindings for reader interface are blocking
Last modified: 2009-08-15 18:40:50 UTC
(Bug report for version 2.5.7, which was not available on bugzilla) Python bindings for inputBuffer/Reader interface use high-level file access (like fread() in C) when low-level access (like reade()) could (and should) be used. Reader waits for some (hardcoded?) number of characters instead of processing what is available. This makes reader.Read() block even if there are full tags available, which could be returned. This is easy to workaround with the following code, but IMHO it should be fixed in the bindings. workaround example: class MyFile: def __init__(self,file): self.fd=file.fileno() self.file=file def read(self,len): return os.read(self.fd,len) input=libxml2.inputBuffer(MyFile(sys.stdin)) reader=input.newTextReader("ble")
As explained in #113580 expecting no buffering at any of the layers just won't work in general. Daniel *** This bug has been marked as a duplicate of 113580 ***