Skip to content

Commit bd3c030

Browse files
authored
Merge pull request #507 from BoboTiG/fix-unclosed-file
Fix a ResourceWarning: unclosed file in core.py
2 parents e4ee61f + 52d823c commit bd3c030

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

httpbin/core.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1725,7 +1725,8 @@ def image_svg():
17251725

17261726
def resource(filename):
17271727
path = os.path.join(tmpl_dir, filename)
1728-
return open(path, "rb").read()
1728+
with open(path, "rb") as f:
1729+
return f.read()
17291730

17301731

17311732
@app.route("/xml")

0 commit comments

Comments
 (0)