diff options
author | Guido van Rossum <guido@python.org> | 2007-11-22 00:30:02 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2007-11-22 00:30:02 (GMT) |
commit | cd4d4527717abc09f13fc57ca9893a1f1591f9c0 (patch) | |
tree | a674a01a99a02917d59b4f0c28a9828bb8cb326f /Lib/doctest.py | |
parent | d05eb0043e597cf2d5c429d0e554fd39364e36b0 (diff) | |
download | cpython-cd4d4527717abc09f13fc57ca9893a1f1591f9c0.zip cpython-cd4d4527717abc09f13fc57ca9893a1f1591f9c0.tar.gz cpython-cd4d4527717abc09f13fc57ca9893a1f1591f9c0.tar.bz2 |
Merged revisions 59077-59104 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r59078 | brett.cannon | 2007-11-20 16:16:20 -0800 (Tue, 20 Nov 2007) | 2 lines
Remove a unneeded line that had typos.
........
r59081 | christian.heimes | 2007-11-20 16:46:21 -0800 (Tue, 20 Nov 2007) | 1 line
Fixed #1372: zlibmodule.c: int overflow in PyZlib_decompress
........
r59082 | brett.cannon | 2007-11-20 16:47:36 -0800 (Tue, 20 Nov 2007) | 6 lines
doctest assumed that a package's __loader__.get_data() method used universal
newlines; it doesn't. To rectify this the string returned replaces all
instances of os.linesep with '\n' to fake universal newline support.
Backport candidate.
........
r59084 | brett.cannon | 2007-11-20 16:58:03 -0800 (Tue, 20 Nov 2007) | 2 lines
Add a missing check before deleting a package's __loader__.
........
r59088 | christian.heimes | 2007-11-20 17:17:28 -0800 (Tue, 20 Nov 2007) | 2 lines
Added NEWS entry
Thanks for the reminder, Brett
........
r59089 | amaury.forgeotdarc | 2007-11-20 17:38:26 -0800 (Tue, 20 Nov 2007) | 2 lines
Add a NEWS entry for r59076.
........
r59091 | christian.heimes | 2007-11-20 18:50:06 -0800 (Tue, 20 Nov 2007) | 2 lines
Final fix for #1403
The Windows installer and some Linux distros are using compileall to compile all py files in the Lib/ directory. However no test exists to check if all py files can be compiled. I figured out that make testall is the easiest way to test compileall.
........
Diffstat (limited to 'Lib/doctest.py')
-rw-r--r-- | Lib/doctest.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/Lib/doctest.py b/Lib/doctest.py index 97bc053..eee2f51 100644 --- a/Lib/doctest.py +++ b/Lib/doctest.py @@ -209,8 +209,11 @@ 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(encoding), - filename) + file_contents = package.__loader__.get_data(filename) + file_contents = file_contents.decode(encoding) + # get_data() opens files as 'rb', so one must do the equivalent + # conversion as universal newlines would do. + return file_contents.replace(os.linesep, '\n'), filename return open(filename, encoding=encoding).read(), filename def _indent(s, indent=4): |