Close file after finished reading in ImageFont._load_pilfont()

Fixes some "ResourceWarning: unclosed file ..." when running tests with
warnings enabled.
This commit is contained in:
Jon Dufresne 2016-11-17 06:21:50 -08:00
parent 17d38d0905
commit 85ec6eb251

View File

@ -62,8 +62,7 @@ class ImageFont(object):
def _load_pilfont(self, filename):
fp = open(filename, "rb")
with open(filename, "rb") as fp:
for ext in (".png", ".gif", ".pbm"):
try:
fullname = os.path.splitext(filename)[0] + ext