From e9fd23165cd7c52e3a7719010e50c9ea154e8e1d Mon Sep 17 00:00:00 2001 From: Brett Cannon Date: Fri, 12 Oct 2007 19:18:19 +0000 Subject: Make _load_testfile() use its encoding argument when __loader__ is defined. --- Lib/doctest.py | 3 ++- Misc/NEWS | 8 ++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) 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): diff --git a/Misc/NEWS b/Misc/NEWS index ba37891..749b94c 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -14,6 +14,14 @@ Extension Modules - The `hotshot` profiler has been removed; use `cProfile` instead. +Library +------- + +- When loading an external file using testfile(), the passed-in encoding + argument was being ignored if __loader__ is defined and forcing the source to + be UTF-8. + + What's New in Python 3.0a1? ========================== -- cgit v0.12