Skip to content

Commit a5390f4

Browse files
committed
Fix schema fh handling
1 parent 0f77cac commit a5390f4

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

signxml/processor.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
@lru_cache
2020
def get_schema(schema_file: str) -> etree.XMLSchema:
2121
pkg_name = "signxml.xades.schemas" if schema_file.startswith("XAdES") else "signxml.schemas"
22-
schema_fh = importlib.resources.open_text(pkg_name, schema_file)
23-
return etree.XMLSchema(etree.parse(schema_fh))
22+
with importlib.resources.open_text(pkg_name, schema_file) as schema_fh:
23+
return etree.XMLSchema(etree.parse(schema_fh))
2424

2525

2626
class XMLProcessor:

0 commit comments

Comments
 (0)