Skip to content
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

Make os.path.join() first parameter pos-only #6812

Merged
merged 4 commits into from
Jan 4, 2022

Conversation

AlexWaygood
Copy link
Member

I was recently surprised to find that the mypy test suite doesn't pass mypy when run on Windows. This is because posixpath.join() and ntpath.join() have different names for the first parameter.

Given that both posixpath and ntpath are undocumented modules -- which only exist to provide platform-specific implementations for the os.path module -- I think it makes sense to make the first parameter positional-only for both functions. The whole point of the os.path module is that you can get path-related functions that will reliably work on all systems. That guarantee goes away if you use a keyword argument for the first parameter of os.path.join().

@AlexWaygood AlexWaygood marked this pull request as ready for review January 4, 2022 11:07
@github-actions

This comment has been minimized.

@github-actions
Copy link
Contributor

github-actions bot commented Jan 4, 2022

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

Copy link
Collaborator

@srittau srittau left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds like a good idea.

@srittau srittau merged commit 582f1e9 into python:master Jan 4, 2022
@AlexWaygood AlexWaygood deleted the os-path branch January 4, 2022 14:39
AlexWaygood added a commit to AlexWaygood/mypy that referenced this pull request Jan 5, 2022
As discussed in python#11895, mypy's test suite currently does not pass a mypy self-check when run on Windows. This should hopefully be fixed by python/typeshed#6812, but running a self-check on Windows as part of the CI tests should help avoid this issue in the future.

This new CI test should hopefully fail until python#11905 is merged, confirming the diagnosis of the problem that I made in python#11895. Once python#11905 is merged, it should hopefully then pass, allowing this PR to be merged.
JelleZijlstra pushed a commit to python/mypy that referenced this pull request Jan 28, 2022
As discussed in #11895, mypy's test suite currently does not pass a mypy self-check when run on Windows. This should hopefully be fixed by python/typeshed#6812, but running a self-check on Windows as part of the CI tests should help avoid this issue in the future.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants