Author: Amaury Forgeot d'Arc <amaur...@gmail.com> Branch: py3.6 Changeset: r93391:ea22b4d272be Date: 2017-12-12 19:21 +0100 http://bitbucket.org/pypy/pypy/changeset/ea22b4d272be/
Log: Oops, fix tests and translation. diff --git a/pypy/module/posix/interp_posix.py b/pypy/module/posix/interp_posix.py --- a/pypy/module/posix/interp_posix.py +++ b/pypy/module/posix/interp_posix.py @@ -151,9 +151,14 @@ except OperationError as e: if not e.match(space, space.w_TypeError): raise - if allow_fd and space.index_CHECK(w_value): - fd = unwrap_fd(space, w_value, "string, bytes or integer") - return Path(fd, None, None, w_value) + if allow_fd: + try: + space.index(w_value) + except OperationError: + pass + else: + fd = unwrap_fd(space, w_value, "string, bytes or integer") + return Path(fd, None, None, w_value) # Inline fspath() for better error messages. w_fspath_method = space.lookup(w_value, '__fspath__') @@ -165,12 +170,12 @@ if allow_fd: raise oefmt(space.w_TypeError, - "illegal type for path parameter (expected " - "string, bytes, os.PathLike or integer, got %T)", w_value) + "illegal type for path parameter (should be " + "string, bytes, os.PathLike or integer, not %T)", w_value) else: raise oefmt(space.w_TypeError, - "illegal type for path parameter (expected " - "string, bytes or os.PathLike, got %T)", w_value) + "illegal type for path parameter (should be " + "string, bytes or os.PathLike, not %T)", w_value) class _PathOrFd(Unwrapper): def unwrap(self, space, w_value): diff --git a/pypy/module/posix/test/test_posix2.py b/pypy/module/posix/test/test_posix2.py --- a/pypy/module/posix/test/test_posix2.py +++ b/pypy/module/posix/test/test_posix2.py @@ -208,7 +208,7 @@ excinfo = raises(TypeError, self.posix.stat, None) assert "can't specify None" in str(excinfo.value) excinfo = raises(TypeError, self.posix.stat, 2.) - assert "should be string, bytes or integer, not float" in str(excinfo.value) + assert "should be string, bytes, os.PathLike or integer, not float" in str(excinfo.value) raises(ValueError, self.posix.stat, -1) raises(ValueError, self.posix.stat, b"abc\x00def") raises(ValueError, self.posix.stat, u"abc\x00def") _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit