mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-29 03:16:18 +03:00
Merge pull request #2232 from jdufresne/font-close-file
Close file after finished reading in ImageFont._load_pilfont()
This commit is contained in:
commit
806e5343d8
|
@ -62,8 +62,7 @@ class ImageFont(object):
|
||||||
|
|
||||||
def _load_pilfont(self, filename):
|
def _load_pilfont(self, filename):
|
||||||
|
|
||||||
fp = open(filename, "rb")
|
with open(filename, "rb") as fp:
|
||||||
|
|
||||||
for ext in (".png", ".gif", ".pbm"):
|
for ext in (".png", ".gif", ".pbm"):
|
||||||
try:
|
try:
|
||||||
fullname = os.path.splitext(filename)[0] + ext
|
fullname = os.path.splitext(filename)[0] + ext
|
||||||
|
|
Loading…
Reference in New Issue
Block a user