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-102613: Fix recursion error from `pathlib.Path.glob()` by barneygale · Pull Request #104373 · python/cpython

Conversation

@barneygale

@barneygale barneygale commented May 11, 2023 •
edited by bedevere-bot
Loading

Uh oh!

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

Copy link
Copy Markdown
Contributor

Use Path.walk() to implement the recursive wildcard **. This method uses an iterative (rather than recursive) walk - see GH-100282.

  • Issue: Path.rglob performance issues in deeply nested directories compared to glob.glob(recursive=True) #102613

Sorry, something went wrong.

Uh oh!

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

All reactions
@barneygale
pythonGH-102613: Fix recursion error from pathlib.Path.glob()
71dc988
Use `Path.walk()` to implement the recursive wildcard `**`. This method
uses an iterative (rather than recursive) walk - see pythonGH-100282.
@barneygale barneygale added the topic-pathlib label May 11, 2023
@bedevere-bot bedevere-bot added the awaiting core review label May 11, 2023
@bedevere-bot bedevere-bot mentioned this pull request May 11, 2023
Path.rglob performance issues in deeply nested directories compared to glob.glob(recursive=True) #102613
Closed
@barneygale

barneygale commented May 11, 2023

Copy link
Copy Markdown
Contributor Author

This won't backport to 3.11, as Path.walk() is new in 3.12.

All reactions

Sorry, something went wrong.

Uh oh!

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

@barneygale

barneygale commented May 11, 2023

Copy link
Copy Markdown
Contributor Author

@Ovsyanka83 would you like to review, if you have a mo? Uses your shiny walk() method! :)

All reactions

Sorry, something went wrong.

Uh oh!

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

@zmievsa

zmievsa commented May 11, 2023

Copy link
Copy Markdown
Contributor

Will take a look on saturday! :)

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

Sorry, something went wrong.

Uh oh!

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

zmievsa
zmievsa suggested changes May 13, 2023
View reviewed changes

@zmievsa zmievsa left a comment •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Thanks for using our work here! Every time "walk" gets used or mentioned, it makes me feel really nice and like my work has made a difference :D

I like the ideas and have a few suggestions here and there -- your logic feels quite right and my changes are doubtful and mostly stylistic :)

Sorry, something went wrong.

Uh oh!

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

barneygale reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
Comment thread Misc/NEWS.d/next/Library/2023-05-11-01-07-42.gh-issue-102613.uMsokt.rst Resolved

Uh oh!

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

Comment thread Lib/pathlib.py Resolved

Uh oh!

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

Comment thread Lib/pathlib.py Resolved

Uh oh!

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

Comment thread Lib/pathlib.py Resolved

Uh oh!

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

zmievsa
zmievsa approved these changes May 14, 2023
View reviewed changes

@zmievsa zmievsa left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

After your replies the logic itself makes much more sense so I'm ready to approve this.

Sorry, something went wrong.

Uh oh!

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

barneygale reacted with heart emoji
All reactions
  • ❤️ 1 reaction
@barneygale

barneygale commented May 14, 2023

Copy link
Copy Markdown
Contributor Author

Thank you!

All reactions

Sorry, something went wrong.

Uh oh!

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

@barneygale

barneygale commented May 14, 2023

Copy link
Copy Markdown
Contributor Author

Hey @carljm, would you be up for reviewing this? You reviewed #100282 which made Path.walk() iterative; it's that work I'm exploiting here. No worries if not, thank you!

All reactions

Sorry, something went wrong.

Uh oh!

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

carljm
carljm approved these changes May 15, 2023
View reviewed changes

@carljm carljm left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

This looks good to me, apart from the one inline comment, which could be addressed as a follow-up also.

Sorry, something went wrong.

Uh oh!

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

All reactions
Comment thread Lib/pathlib.py Resolved

Uh oh!

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

@bedevere-bot bedevere-bot added awaiting merge and removed awaiting core review labels May 15, 2023
@barneygale
barneygale merged commit cb88ae6 into python:main May 15, 2023
@bedevere-bot bedevere-bot removed the awaiting merge label May 15, 2023
carljm added a commit to carljm/cpython that referenced this pull request May 16, 2023
@carljm
Merge branch 'main' into supermon
a6dd626
* main:
  pythonGH-104510: Fix refleaks in `_io` base types (python#104516)
  pythongh-104539: Fix indentation error in logging.config.rst (python#104545)
  pythongh-104050: Don't star-import 'types' in Argument Clinic (python#104543)
  pythongh-104050: Add basic typing to CConverter in clinic.py (python#104538)
  pythongh-64595: Fix write file logic in Argument Clinic (python#104507)
  pythongh-104523: Inline minimal PGO rules (python#104524)
  pythongh-103861: Fix Zip64 extensions not being properly applied in some cases (python#103863)
  pythongh-69152: add method get_proxy_response_headers to HTTPConnection class (python#104248)
  pythongh-103763: Implement PEP 695 (python#103764)
  pythongh-104461: Run tkinter test_configure_screen on X11 only (pythonGH-104462)
  pythongh-104469: Convert _testcapi/watchers.c to use Argument Clinic (python#104503)
  pythongh-104482: Fix error handling bugs in ast.c (python#104483)
  pythongh-104341: Adjust tstate_must_exit() to Respect Interpreter Finalization (pythongh-104437)
  pythonGH-102613: Fix recursion error from `pathlib.Path.glob()` (pythonGH-104373)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@AlexWaygood AlexWaygood AlexWaygood left review comments
@carljm carljm carljm approved these changes
+1 more reviewer
@zmievsa zmievsa zmievsa approved these changes
Reviewers whose approvals may not affect merge requirements

Uh oh!

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

Assignees

No one assigned

Labels

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.

5 participants

@barneygale @zmievsa @carljm @AlexWaygood @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.