]> granicus.if.org Git - python/commitdiff
#7667: Fix doctest failures with non-ASCII paths.
authorFlorent Xicluna <florent.xicluna@gmail.com>
Mon, 22 Mar 2010 22:45:50 +0000 (22:45 +0000)
committerFlorent Xicluna <florent.xicluna@gmail.com>
Mon, 22 Mar 2010 22:45:50 +0000 (22:45 +0000)
Lib/doctest.py
Misc/NEWS

index 726517e6ca128061caf9d96e7fc37a2c722f82bf..a9357b599d0c31919cd927777e7fa27a75b047b6 100644 (file)
@@ -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)
 
index f207082978bb2ceed9b27c707b171024476aee35..f05e90ef1e42ab217acb597792745ffa9ebd1bec 100644 (file)
--- 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.