diff options
| author | Brett Cannon <bcannon@gmail.com> | 2007-11-21 00:58:54 (GMT) |
|---|---|---|
| committer | Brett Cannon <bcannon@gmail.com> | 2007-11-21 00:58:54 (GMT) |
| commit | d3a81df178474f76407089de318a68554fe36841 (patch) | |
| tree | 04d1373361b4387e0f8fd4a6efcae016ff444e93 /Lib/doctest.py | |
| parent | 946a51c187827adad860c6bb1986268ae68635d0 (diff) | |
| download | cpython-d3a81df178474f76407089de318a68554fe36841.zip cpython-d3a81df178474f76407089de318a68554fe36841.tar.gz cpython-d3a81df178474f76407089de318a68554fe36841.tar.bz2 | |
Backport of r59082 (doctest and using __loader__.get_data()).
Diffstat (limited to 'Lib/doctest.py')
| -rw-r--r-- | Lib/doctest.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/Lib/doctest.py b/Lib/doctest.py index 32d076a..d609c5d 100644 --- a/Lib/doctest.py +++ b/Lib/doctest.py @@ -209,7 +209,10 @@ def _load_testfile(filename, package, module_relative): filename = _module_relative_path(package, filename) if hasattr(package, '__loader__'): if hasattr(package.__loader__, 'get_data'): - return package.__loader__.get_data(filename), filename + file_contents = package.__loader__.get_data(filename) + # 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).read(), filename def _indent(s, indent=4): |
