summaryrefslogtreecommitdiff
path: root/sphinx/builders/devhelp.py
diff options
context:
space:
mode:
authorTakeshi KOMIYA <i.tkomiya@gmail.com>2016-05-26 00:27:07 +0900
committerTakeshi KOMIYA <i.tkomiya@gmail.com>2016-05-26 00:50:57 +0900
commit698a715d0c905079b215034d04cb3f1d8e809dd5 (patch)
treeb78c56a74ce3960214c6e51d775846c09e0d288f /sphinx/builders/devhelp.py
parentebc888d709ec8812bf6e158f919f6da23d38595c (diff)
downloadsphinx-git-698a715d0c905079b215034d04cb3f1d8e809dd5.tar.gz
Refactor code using ``with`` syntax
Diffstat (limited to 'sphinx/builders/devhelp.py')
-rw-r--r--sphinx/builders/devhelp.py5
1 files changed, 1 insertions, 4 deletions
diff --git a/sphinx/builders/devhelp.py b/sphinx/builders/devhelp.py
index 5ebaf2dc5..9f95de0e1 100644
--- a/sphinx/builders/devhelp.py
+++ b/sphinx/builders/devhelp.py
@@ -127,8 +127,5 @@ class DevhelpBuilder(StandaloneHTMLBuilder):
write_index(title, refs, subitems)
# Dump the XML file
- f = comp_open(path.join(outdir, outname + '.devhelp'), 'w')
- try:
+ with comp_open(path.join(outdir, outname + '.devhelp'), 'w') as f:
tree.write(f, 'utf-8')
- finally:
- f.close()