Skip to content

Commit

Permalink
minor: fix ResourceWarning about unclosed file descriptor
Browse files Browse the repository at this point in the history
  • Loading branch information
anthrotype committed Dec 3, 2021
1 parent e80c09b commit e71c031
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions Lib/glyphsLib/glyphdata.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,9 @@ def get_glyph(glyph_name, data=None, unicodes=None):
if GLYPHDATA is None:
from importlib.resources import open_binary

GLYPHDATA = GlyphData.from_files(
open_binary("glyphsLib.data", "GlyphData.xml"),
open_binary("glyphsLib.data", "GlyphData_Ideographs.xml"),
)
with open_binary("glyphsLib.data", "GlyphData.xml") as f1:
with open_binary("glyphsLib.data", "GlyphData_Ideographs.xml") as f2:
GLYPHDATA = GlyphData.from_files(f1, f2)
data = GLYPHDATA

# Look up data by full glyph name first.
Expand Down

0 comments on commit e71c031

Please sign in to comment.