DebugClients/Python/coverage/codeunit.py

changeset 4385
599681bf149a
parent 3499
f2d4b02c7e88
diff -r 04896c4a5a8e -r 599681bf149a DebugClients/Python/coverage/codeunit.py
--- a/DebugClients/Python/coverage/codeunit.py	Sun Aug 23 11:31:11 2015 +0200
+++ b/DebugClients/Python/coverage/codeunit.py	Sun Aug 23 11:37:17 2015 +0200
@@ -1,6 +1,6 @@
 """Code unit (module) handling for Coverage."""
 
-import glob, os
+import glob, os, sys
 
 from .backward import open_source, string_class, StringIO
 from .misc import CoverageException
@@ -57,6 +57,8 @@
         elif f.endswith('$py.class'): # Jython
             f = f[:-9] + ".py"
         self.filename = self.file_locator.canonical_filename(f)
+        if isinstance(self.filename, unicode):
+            self.filename = self.filename.encode(sys.getfilesystemencoding())
 
         if hasattr(morf, '__name__'):
             n = modname = morf.__name__
@@ -64,6 +66,8 @@
         else:
             n = os.path.splitext(morf)[0]
             rel = self.file_locator.relative_filename(n)
+            if isinstance(rel, unicode):
+                rel = rel.encode(sys.getfilesystemencoding())
             if os.path.isabs(n):
                 self.relative = (rel != n)
             else:

eric ide

mercurial