summaryrefslogtreecommitdiff
path: root/sphinx/directives/code.py
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2010-05-22 10:49:42 +0200
committerGeorg Brandl <georg@python.org>2010-05-22 10:49:42 +0200
commitcbf309fa65d3abac869b94c47099b16ce1431d3c (patch)
treeb32fae4de3f681d4ce374348a47eefb60b19f93c /sphinx/directives/code.py
parent2477249d42a338ef55f259ad2cf2c506d1032696 (diff)
downloadsphinx-git-cbf309fa65d3abac869b94c47099b16ce1431d3c.tar.gz
#414: fix universal newline handling of files included with "literalinclude".
codecs.open() does not support U in the mode argument; use the EncodedFile wrapper instead.
Diffstat (limited to 'sphinx/directives/code.py')
-rw-r--r--sphinx/directives/code.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/sphinx/directives/code.py b/sphinx/directives/code.py
index f5a8f8af4..65bd01227 100644
--- a/sphinx/directives/code.py
+++ b/sphinx/directives/code.py
@@ -116,7 +116,7 @@ class LiteralInclude(Directive):
encoding = self.options.get('encoding', env.config.source_encoding)
try:
- f = codecs.open(fn, 'rU', encoding)
+ f = codecs.EncodedFile(open(fn, 'U'), encoding)
lines = f.readlines()
f.close()
except (IOError, OSError):