[ttLib] raise if saving TTFont to the same input file when lazy is True

This commit is contained in:
Cosimo Lupo 2016-01-25 10:21:09 +00:00
parent 3f7c67ed50
commit 81b290a47b

View File

@ -185,6 +185,9 @@ class TTFont(object):
"""
from fontTools.ttLib import sfnt
if not hasattr(file, "write"):
if self.lazy and self.reader.file.name == file:
raise TTLibError(
"Can't overwrite TTFont when 'lazy' attribute is True")
closeStream = 1
file = open(file, "wb")
else: