bpo-32642: add support for path-like objects in sys.path#32118
bpo-32642: add support for path-like objects in sys.path#32118noamcohen97 wants to merge 2 commits into
Conversation
|
Hello, and thanks for your contribution! I'm a bot set up to make sure that the project can legally accept this contribution by verifying everyone involved has signed the PSF contributor agreement (CLA). CLA MissingOur records indicate the following people have not signed the CLA: For legal reasons we need all the people listed to sign the CLA before we can look at your contribution. Please follow the steps outlined in the CPython devguide to rectify this issue. If you have recently signed the CLA, please wait at least one business day You can check yourself to see if the CLA has been received. Thanks again for the contribution, we look forward to reviewing it! |
|
Could you add a test please? The existing test doesn't exercise the code changes. |
The sys.path did only accept `str` or `bytes` object. This change makes `os.PathLike` object to be accepted as well.
194b978 to
a8c5f54
Compare
|
|
||
| def setUp(self): | ||
| self.test_dir = tempfile.mkdtemp() | ||
| self.test_dir = pathlib.Path(tempfile.mkdtemp()) |
There was a problem hiding this comment.
this removes the test for str on sys.path
| for entry in path: | ||
| if not isinstance(entry, str): | ||
| try: | ||
| # bytes, str and path-like objects will pass fspath |
There was a problem hiding this comment.
you need to add a test for bytes on sys.path, and test it with the other import systems. Note these tests fail with a BytesWarning
|
@noamcohen97 the issue for this was closed - #76823 (comment) you should raise the request on discuss https://discuss.python.org/c/ideas/6 |
Suggesting then to close this PR. |
The sys.path did only accept
strorbytesobject. This changemakes
os.PathLikeobject to be accepted as well.https://bugs.python.org/issue32642