[ttLib] call XMLWriter.close() only if 'fileOrPath' is a path, not when it's a file
This allows to call `TTFont.saveXML` with an already open file/stream (e.g. sys.stdout or a StringIO) without it being abruptly closed at the end. We do the same elsewhere when we reiceive file handles instead of path names, so we might do it here too.
This commit is contained in:
parent
faeba0c0c0
commit
84d6f076a3
@ -308,7 +308,9 @@ class TTFont(object):
|
||||
progress.set((i + 1))
|
||||
writer.endtag("ttFont")
|
||||
writer.newline()
|
||||
writer.close()
|
||||
# close if 'fileOrPath' is a path; leave it open if it's a file
|
||||
if not hasattr(fileOrPath, "write"):
|
||||
writer.close()
|
||||
|
||||
def _tableToXML(self, writer, tag, progress, quiet=None):
|
||||
if quiet is not None:
|
||||
|
Loading…
x
Reference in New Issue
Block a user