Commits

Antoine Pitrou committed 26ece40

Symlink loops now raise RuntimeError, not ValueError

Comments (0)

Files changed (3)

       PosixPath('/home/antoine/pathlib/setup.py')
 
    If the path doesn't exist, an :exc:`OSError` is raised.  If an infinite
-   loop is encountered along the resolution path, :exc:`ValueError` is raised.
+   loop is encountered along the resolution path, :exc:`RuntimeError` is
+   raised.
 
 
 .. method:: Path.rglob(pattern)
             if cur in symlinks and symlinks[cur] <= len(parts):
                 # We've already seen the symlink and there's not less
                 # work to do than the last time.
-                raise ValueError("Symlink loop from %r" % cur)
+                raise RuntimeError("Symlink loop from %r" % cur)
             try:
                 target = accessor.readlink(cur)
             except OSError as e:
 
     def _check_symlink_loop(self, *args):
         path = self.cls(*args)
-        with self.assertRaises(ValueError):
+        with self.assertRaises(RuntimeError):
             print(path.resolve())
 
     def test_open_mode(self):