GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Update os.path.isdir on Windows Python3.12+ by aminalaee · Pull Request #10751 · python/typeshed

Conversation

@aminalaee

@aminalaee aminalaee commented Sep 22, 2023 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Following #10748 (comment)
cc @AlexWaygood

Ref: https://github.com/python/cpython/blame/b28ffaa193efc66f46ab90d383279174a11a11d7/Modules/clinic/posixmodule.c.h#L1989

Seems like os.path.isdir has different signature os.path.isdir(path) compared to os.path.isdir(s) in netpath.py, not sure if this was intentional in CPython.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@aminalaee
aminalaee force-pushed the python3.12-windows-os-path-isdir branch 2 times, most recently from afafed0 to 9de14dd Compare September 22, 2023 18:55
@github-actions

This comment has been minimized.

Sign in to view
@aminalaee
aminalaee force-pushed the python3.12-windows-os-path-isdir branch 2 times, most recently from ebc8fb4 to 06d0e14 Compare September 22, 2023 19:12
@aminalaee
Update os.path.isdir on Windows Python3.12+
b82ffc2
@aminalaee
aminalaee force-pushed the python3.12-windows-os-path-isdir branch from 06d0e14 to b82ffc2 Compare September 22, 2023 19:15
@github-actions

github-actions Bot commented Sep 22, 2023

Copy link
Copy Markdown
Contributor

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

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@aminalaee
aminalaee marked this pull request as ready for review September 22, 2023 21:19
@JelleZijlstra

JelleZijlstra commented Sep 23, 2023

Copy link
Copy Markdown
Member

This feels unfortunate and maybe should be fixed in CPython instead. Or perhaps the parameter should be made positional-only.

AlexWaygood and aminalaee reacted with thumbs up emoji
All reactions
  • 👍 2 reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@AlexWaygood

AlexWaygood commented Sep 23, 2023 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

This feels unfortunate and maybe should be fixed in CPython instead. Or perhaps the parameter should be made positional-only.

Yeah, I think one of the two would be the better fix. Kinda the point of os.path is that the module is meant to be an abstraction that's fully cross-platform. So it makes things somewhat awkward when a function in os.path has a different signature on Windows than on other platforms. See #6812, where we had a similar issue, and tackled it by pretending the parameter was positional-only.

Here I think the best solution might be to raise this with CPython. Since the ntpath implementation is new, it seems unlikely to me that they intended to give it a different parameter name to the posix implementation.

hauntsaninja and aminalaee reacted with thumbs up emoji
All reactions
  • 👍 2 reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@aminalaee

aminalaee commented Sep 23, 2023

Copy link
Copy Markdown
Contributor Author

Yeah I think if this was not intentional in CPython, there's still time to change it. I will open an issue now.

AlexWaygood reacted with heart emoji
All reactions
  • ❤️ 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@aminalaee aminalaee mentioned this pull request Sep 23, 2023
Windows os.path.isdir has different signature python/cpython#109782
Closed
@JelleZijlstra

JelleZijlstra commented Sep 29, 2023

Copy link
Copy Markdown
Member

The fix was merged into CPython and is planned to go into 3.12 eventually, so I think we shouldn't change anything here. Thanks for uncovering this issue!

AlexWaygood reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@JelleZijlstra JelleZijlstra closed this Sep 29, 2023
@aminalaee
aminalaee deleted the python3.12-windows-os-path-isdir branch September 29, 2023 07:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@aminalaee @JelleZijlstra @AlexWaygood
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.