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

GH-118289: Fix handling of non-directories in os.path.realpath() #120127

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

barneygale
Copy link
Contributor

@barneygale barneygale commented Jun 5, 2024

In strict mode, raise NotADirectoryError if we encounter a non-directory while we still have path parts left to process.

We use a part_count variable rather than len(rest) because the rest stack also contains markers for unresolved symlinks.

In strict mode, raise `NotADirectoryError` if we encounter a non-directory
while we still have path parts left to process.

We use a `part_count` variable rather than `len(rest)` because the `rest`
stack also contains markers for unresolved symlinks.
@barneygale
Copy link
Contributor Author

Follow-up to #118290, where I messed up a rebase and notified everyone (whoops!)

Copy link
Member

@serhiy-storchaka serhiy-storchaka left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks.

How does it work on Windows? Could you add generic tests for these cases?

@nineteendo
Copy link
Contributor

Wouldn't this be easier to implement when rest can't include markers for unresolved symlinks? #119172

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants