[Python-3000-checkins] r58439 - in python/branches/py3k: Lib/doctest.py Misc/NEWS

brett.cannon python-3000-checkins at python.org
Fri Oct 12 21:18:20 CEST 2007


Author: brett.cannon
Date: Fri Oct 12 21:18:19 2007
New Revision: 58439

Modified:
   python/branches/py3k/Lib/doctest.py
   python/branches/py3k/Misc/NEWS
Log:
Make _load_testfile() use its encoding argument when __loader__ is defined.


Modified: python/branches/py3k/Lib/doctest.py
==============================================================================
--- python/branches/py3k/Lib/doctest.py	(original)
+++ python/branches/py3k/Lib/doctest.py	Fri Oct 12 21:18:19 2007
@@ -209,7 +209,8 @@
         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):

Modified: python/branches/py3k/Misc/NEWS
==============================================================================
--- python/branches/py3k/Misc/NEWS	(original)
+++ python/branches/py3k/Misc/NEWS	Fri Oct 12 21:18:19 2007
@@ -14,6 +14,14 @@
 - 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?
 ==========================
 


More information about the Python-3000-checkins mailing list