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 — GH-77609: Support following symlinks in `pathlib.Path.glob()` by barneygale · Pull Request #104176 · python/cpython

Conversation

@barneygale

@barneygale barneygale commented May 4, 2023 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Contributor

Add support for *** wildcard in pathlib.Path.glob() and rglob(). This wildcard works like **, except that it also recurses into symlinks.

See Recursive Globbing in the zshexpn manpage for prior art.

Alternative to #102616

  • Issue: pathlib.Path.glob does not follow symlinks #77609

Sorry, something went wrong.

Uh oh!

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

All reactions
@barneygale
pythonGH-77609: Support following symlinks in pathlib.Path.glob()
ec181bb
@barneygale barneygale added the topic-pathlib label May 4, 2023
@bedevere-bot bedevere-bot mentioned this pull request May 4, 2023
pathlib.Path.glob does not follow symlinks #77609
Closed
@bedevere-bot bedevere-bot added the awaiting core review label May 4, 2023
@barneygale barneygale mentioned this pull request May 4, 2023
GH-77609: Add follow_symlinks argument to pathlib.Path.glob() #102616
Merged
@barneygale
Merge branch 'main' into pythongh-77609-glob-follow-symlinks-triple-star
2405074
@barneygale barneygale mentioned this pull request May 6, 2023
Path.rglob performance issues in deeply nested directories compared to glob.glob(recursive=True) #102613
Closed
barneygale added 2 commits May 7, 2023 22:26
@barneygale
Merge branch 'main' into pythongh-77609-glob-follow-symlinks-triple-star
83001af
@barneygale
Remove stray newline
fa10d28
@barneygale

barneygale commented May 8, 2023

Copy link
Copy Markdown
Contributor Author

Marking as a draft because it would be good to land #104292 and #104141 first.

All reactions

Sorry, something went wrong.

Uh oh!

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

@barneygale
barneygale marked this pull request as draft May 8, 2023 14:47
@zooba

zooba commented May 8, 2023

Copy link
Copy Markdown
Member

How does this help us fix the mixed up behaviour of the current function?

All reactions

Sorry, something went wrong.

Uh oh!

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

@barneygale

barneygale commented May 8, 2023

Copy link
Copy Markdown
Contributor Author

I don't think the current behaviour is wrong, just difficult to optimize. With this PR, users would be able to recursively walk symlinks, and we'd be able to optimize ***/*.py later on (but not **/*.py). Still, I'm not convinced this is the right way forward.

All reactions

Sorry, something went wrong.

Uh oh!

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

@zooba

zooba commented May 8, 2023

Copy link
Copy Markdown
Member

Still, I'm not convinced this is the right way forward.

I'm surprised, because you closed the other PR saying you were convinced this was the way forward.

Personally, I preferred the other way. It's a bit more work, but in ~5 years time we'll have forgotten about it and will just have sensible defaults. Adding this way and leaving the other one leaves us with two warts (okay, maybe 1.5, if people like this, but I feel like special patterns specifically for symlinks is too much).

All reactions

Sorry, something went wrong.

Uh oh!

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

@barneygale

barneygale commented May 8, 2023

Copy link
Copy Markdown
Contributor Author

Still, I'm not convinced this is the right way forward.

I'm surprised, because you closed the other PR saying you were convinced this was the way forward.

I know. I literally changed my mind again last night while playing around with the glob() implementation! :P

Personally, I preferred the other way. It's a bit more work, but in ~5 years time we'll have forgotten about it and will just have sensible defaults. Adding this way and leaving the other one leaves us with two warts (okay, maybe 1.5, if people like this, but I feel like special patterns specifically for symlinks is too much).

👍 fair point, thanks for the advice.

zooba 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.

@barneygale

barneygale commented May 23, 2023

Copy link
Copy Markdown
Contributor Author

Closing in favour of #102616

All reactions

Sorry, something went wrong.

Uh oh!

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

@barneygale barneygale closed this May 23, 2023
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

awaiting core review topic-pathlib

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

@barneygale @zooba @bedevere-bot
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.