summaryrefslogtreecommitdiffstats
path: root/Lib/doctest.py
diff options
context:
space:
mode:
authorBrett Cannon <bcannon@gmail.com>2007-10-12 19:18:19 (GMT)
committerBrett Cannon <bcannon@gmail.com>2007-10-12 19:18:19 (GMT)
commite9fd23165cd7c52e3a7719010e50c9ea154e8e1d (patch)
treec9f910a63ec77d54868d9907e01d7fa4bde6e7dc /Lib/doctest.py
parent5c5f1703e558c9308c9d305f7927bf92e0180c31 (diff)
downloadcpython-e9fd23165cd7c52e3a7719010e50c9ea154e8e1d.zip
cpython-e9fd23165cd7c52e3a7719010e50c9ea154e8e1d.tar.gz
cpython-e9fd23165cd7c52e3a7719010e50c9ea154e8e1d.tar.bz2
Make _load_testfile() use its encoding argument when __loader__ is defined.
Diffstat (limited to 'Lib/doctest.py')
-rw-r--r--Lib/doctest.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/Lib/doctest.py b/Lib/doctest.py
index 395f8b6..0b9be45 100644
--- a/Lib/doctest.py
+++ b/Lib/doctest.py
@@ -209,7 +209,8 @@ def _load_testfile(filename, package, module_relative, encoding):
filename = _module_relative_path(package, filename)
if hasattr(package, '__loader__'):
if hasattr(package.__loader__, 'get_data'):
- return package.__loader__.get_data(filename).decode('utf-8'), filename
+ return (package.__loader__.get_data(filename).decode(encoding),
+ filename)
return open(filename, encoding=encoding).read(), filename
def _indent(s, indent=4):