[Python-checkins] cpython (3.5): doctest: fix _module_relative_path() error message

victor.stinner python-checkins at python.org
Fri Mar 25 07:51:32 EDT 2016


https://hg.python.org/cpython/rev/ce7fdd69ba2c
changeset:   100747:ce7fdd69ba2c
branch:      3.5
parent:      100739:357d1ed928fe
user:        Victor Stinner <victor.stinner at gmail.com>
date:        Fri Mar 25 12:50:36 2016 +0100
summary:
  doctest: fix _module_relative_path() error message

Write the module name rather than <module> in the error message, if module has
no __file__ attribute (ex: package).

files:
  Lib/doctest.py |  5 +++--
  1 files changed, 3 insertions(+), 2 deletions(-)


diff --git a/Lib/doctest.py b/Lib/doctest.py
--- a/Lib/doctest.py
+++ b/Lib/doctest.py
@@ -399,8 +399,9 @@
             basedir = os.curdir
     else:
         # A module w/o __file__ (this includes builtins)
-        raise ValueError("Can't resolve paths relative to the module " +
-                         module + " (it has no __file__)")
+        raise ValueError("Can't resolve paths relative to the module "
+                         "%r (it has no __file__)"
+                         % module.__name__)
 
     # Combine the base directory and the path.
     return os.path.join(basedir, *(path.split('/')))

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list