summaryrefslogtreecommitdiff
path: root/pygments/formatters/__init__.py
diff options
context:
space:
mode:
authorAnteru <bitbucket@ca.sh13.net>2019-04-30 15:52:31 +0000
committerAnteru <bitbucket@ca.sh13.net>2019-04-30 15:52:31 +0000
commit28a21bdafa1b73d5515de18bd263797af61c2471 (patch)
tree3436c730359d89153f04ef572368abfcde1d3fcb /pygments/formatters/__init__.py
parente3872ea8f65ac2c3c40046a7a3acf4f0541f0e56 (diff)
parent601e6e86e45f31e23a7b29e1265d68aeba5e1366 (diff)
downloadpygments-28a21bdafa1b73d5515de18bd263797af61c2471.tar.gz
Merged in andrescarrasco/pygments-main/boa (pull request #756)
Add a lexer for the Boa Domain-Specific Langauge.
Diffstat (limited to 'pygments/formatters/__init__.py')
-rw-r--r--pygments/formatters/__init__.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/pygments/formatters/__init__.py b/pygments/formatters/__init__.py
index 965c5f1a..457d76ec 100644
--- a/pygments/formatters/__init__.py
+++ b/pygments/formatters/__init__.py
@@ -98,7 +98,8 @@ def load_formatter_from_file(filename, formattername="CustomFormatter",
try:
# This empty dict will contain the namespace for the exec'd file
custom_namespace = {}
- exec(open(filename, 'rb').read(), custom_namespace)
+ with open(filename, 'rb') as f:
+ exec(f.read(), custom_namespace)
# Retrieve the class `formattername` from that namespace
if formattername not in custom_namespace:
raise ClassNotFound('no valid %s class found in %s' %