Vincent Legoll committed a665609

Fix ERROR: test_absolute_import_without_future (test.test_import.RelativeImportTests)
ValueError is raised when ImportError should have been.

The ValueError is raised from within cpython's Lib/, as shown:

$ python2.7
Python 2.7.0+ (r27:82500, Sep 15 2010, 18:14:55)
[GCC 4.4.5] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from .os import sep
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: Attempted relative import in non-package

  • Participants
  • Parent commits a527fd2

Comments (0)

Files changed (1)

File pypy/module/imp/

         if level > 0:
             msg = "Attempted relative import in non-package"
-            raise OperationError(space.w_ValueError, w(msg))
+            raise OperationError(space.w_ImportError, w(msg))
     w_mod = absolute_import_try(space, modulename, 0, fromlist_w)
     if w_mod is None or space.is_w(w_mod, space.w_None):
         w_mod = absolute_import(space, modulename, 0, fromlist_w, tentative=0)