From: Florent Xicluna Date: Mon, 22 Mar 2010 22:45:50 +0000 (+0000) Subject: #7667: Fix doctest failures with non-ASCII paths. X-Git-Tag: v2.7b1~246 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e1f4c92d23d9fb71bbaf76be12e80757c7d43e6a;p=python #7667: Fix doctest failures with non-ASCII paths. --- diff --git a/Lib/doctest.py b/Lib/doctest.py index 726517e6ca..a9357b599d 100644 --- a/Lib/doctest.py +++ b/Lib/doctest.py @@ -1328,7 +1328,8 @@ class DocTestRunner: m = self.__LINECACHE_FILENAME_RE.match(filename) if m and m.group('name') == self.test.name: example = self.test.examples[int(m.group('examplenum'))] - return example.source.splitlines(True) + source = example.source.encode('ascii', 'backslashreplace') + return source.splitlines(True) else: return self.save_linecache_getlines(filename, module_globals) diff --git a/Misc/NEWS b/Misc/NEWS index f207082978..f05e90ef1e 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -29,6 +29,8 @@ Core and Builtins Library ------- +- Issue #7667: Fix doctest failures with non-ASCII paths. + - Issue #7512: shutil.copystat() could raise an OSError when the filesystem didn't support chflags() (for example ZFS under FreeBSD). The error is now silenced.