-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Change some os.path stubs to acknowledge __fspath__ protocol support in >=Python3.6 #1997
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
JelleZijlstra
added a commit
to JelleZijlstra/typeshed
that referenced
this issue
Apr 14, 2018
Fixes python#1997. This is tricky because we need to get the return values right (see python#1960 for prior attempts) and we often run into python/mypy#3644. I found that I could express most signatures correctly using a series of overloads. A few other changes in here: - Added splitunc, which according to https://docs.python.org/3/library/os.path.html should exist in both Unix and Windows. - Made the second argument to os.path.curdir Optional to match the implementation. - Fixed os.path.split, whose previous Path-aware signature triggered python/mypy#3644. I used the following test program to make sure mypy accepted the signatures used here:
This was referenced Apr 14, 2018
JelleZijlstra
added a commit
that referenced
this issue
May 15, 2018
Fixes #1997, #2068. This is tricky because we need to get the return values right (see #1960 for prior attempts) and we often run into python/mypy#3644. I found that I could express most signatures correctly using a series of overloads. A few other changes in here: - Added splitunc, which according to https://docs.python.org/3/library/os.path.html should exist in both Unix and Windows. - Made the second argument to os.path.curdir Optional to match the implementation. - Fixed os.path.split, whose previous Path-aware signature triggered python/mypy#3644.
gwk
pushed a commit
to gwk/typeshed
that referenced
this issue
May 29, 2018
Fixes python#1997, python#2068. This is tricky because we need to get the return values right (see python#1960 for prior attempts) and we often run into python/mypy#3644. I found that I could express most signatures correctly using a series of overloads. A few other changes in here: - Added splitunc, which according to https://docs.python.org/3/library/os.path.html should exist in both Unix and Windows. - Made the second argument to os.path.curdir Optional to match the implementation. - Fixed os.path.split, whose previous Path-aware signature triggered python/mypy#3644.
yedpodtrzitko
pushed a commit
to yedpodtrzitko/typeshed
that referenced
this issue
Jan 23, 2019
Fixes python#1997, python#2068. This is tricky because we need to get the return values right (see python#1960 for prior attempts) and we often run into python/mypy#3644. I found that I could express most signatures correctly using a series of overloads. A few other changes in here: - Added splitunc, which according to https://docs.python.org/3/library/os.path.html should exist in both Unix and Windows. - Made the second argument to os.path.curdir Optional to match the implementation. - Fixed os.path.split, whose previous Path-aware signature triggered python/mypy#3644.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Example:
Is valid python because Python3.6 os.path has been changed to accept the
__fspath__
protocolHowever mypy outputs:
Relevant location: https://github.com/python/typeshed/blob/master/stdlib/3/os/path.pyi#L79
The text was updated successfully, but these errors were encountered: