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 — bpo-39906: add follow_symlinks parameter to pathlib.Path.stat() and chmod() by barneygale · Pull Request #18864 · python/cpython

Conversation

@barneygale

@barneygale barneygale commented Mar 9, 2020 •
edited by bedevere-bot
Loading

Uh oh!

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

Copy link
Copy Markdown
Contributor

Backwards-compatible change that makes this work:

import pathlib
p = pathlib.Path("/some/symlink")
assert p.stat(follow_symlinks=True) == p.stat()
assert p.stat(follow_symlinks=False) == p.lstat()

This brings pathlib in line with the newish follow_symlinks parameters in os functions, and arguably provides a more explicit (and nicer?) interface.

For consistency I've applied the same change to chmod(), though as far as I can tell, changing permissions on symlinks is only available on some BSDs (see bpo-7479)

https://bugs.python.org/issue39906

Sorry, something went wrong.

Uh oh!

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

russelldavis reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
@the-knights-who-say-ni

the-knights-who-say-ni commented Mar 9, 2020

Copy link
Copy Markdown

Hello, and thanks for your contribution!

I'm a bot set up to make sure that the project can legally accept this contribution by verifying everyone involved has signed the PSF contributor agreement (CLA).

CLA Missing

Our records indicate the following people have not signed the CLA:

@barneygale

For legal reasons we need all the people listed to sign the CLA before we can look at your contribution. Please follow the steps outlined in the CPython devguide to rectify this issue.

If you have recently signed the CLA, please wait at least one business day
before our records are updated.

You can check yourself to see if the CLA has been received.

Thanks again for the contribution, we look forward to reviewing it!

All reactions

Sorry, something went wrong.

Uh oh!

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

@the-knights-who-say-ni the-knights-who-say-ni added the CLA not signed label Mar 9, 2020
@bedevere-bot bedevere-bot added the awaiting review label Mar 9, 2020
@the-knights-who-say-ni the-knights-who-say-ni added CLA signed and removed CLA not signed labels Mar 9, 2020
@barneygale
barneygale force-pushed the bpo-39906-pathlib-path-follow-symlinks branch from a0720ed to 3ede281 Compare March 10, 2020 20:52
@barneygale
barneygale force-pushed the bpo-39906-pathlib-path-follow-symlinks branch 2 times, most recently from 7782e14 to 7f5854a Compare March 30, 2020 01:25
pitrou
pitrou previously requested changes Apr 17, 2020
View reviewed changes

@pitrou pitrou 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.

The addition looks good on the principle. Two comments though. Also, you'll need to rebase / merge from master.

Sorry, something went wrong.

Uh oh!

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

All reactions
Comment thread Doc/library/pathlib.rst Resolved

Uh oh!

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

Comment thread Doc/library/pathlib.rst Resolved

Uh oh!

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

@bedevere-bot bedevere-bot added awaiting changes and removed awaiting review labels Apr 17, 2020
@bedevere-bot

bedevere-bot commented Apr 17, 2020

Copy link
Copy Markdown

A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.

Once you have made the requested changes, please leave a comment on this pull request containing the phrase I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

All reactions

Sorry, something went wrong.

Uh oh!

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

@csabella

csabella commented May 23, 2020

Copy link
Copy Markdown
Contributor

@barneygale, please address the review comments. Thank you!

All reactions

Sorry, something went wrong.

Uh oh!

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

@barneygale
barneygale force-pushed the bpo-39906-pathlib-path-follow-symlinks branch from 7f5854a to e9b6598 Compare May 29, 2020 01:09
@barneygale

barneygale commented May 29, 2020

Copy link
Copy Markdown
Contributor Author

Rebased + docs versions fixed

All reactions

Sorry, something went wrong.

Uh oh!

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

@barneygale

barneygale commented May 29, 2020

Copy link
Copy Markdown
Contributor Author

I have made the requested changes; please review again

All reactions

Sorry, something went wrong.

Uh oh!

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

@bedevere-bot bedevere-bot added awaiting change review and removed awaiting changes labels May 29, 2020
@bedevere-bot

bedevere-bot commented May 29, 2020

Copy link
Copy Markdown

Thanks for making the requested changes!

@pitrou: please review the changes made to this pull request.

All reactions

Sorry, something went wrong.

Uh oh!

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

@bedevere-bot
bedevere-bot requested a review from pitrou May 29, 2020 01:19
@russelldavis

russelldavis commented Jun 17, 2020

Copy link
Copy Markdown
Contributor

This is great, thanks. Not sure whether it's out of scope for this PR, but it might also be nice to add the follow_symlinks param to some of the methods that call stat() internally, in particular is_file() and is_dir() (this would be consistent with those same methods on os.DirEntry).

barneygale 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 force-pushed the bpo-39906-pathlib-path-follow-symlinks branch from e9b6598 to 2cc9f3b Compare January 21, 2021 23:37
@barneygale

barneygale commented Jan 22, 2021

Copy link
Copy Markdown
Contributor Author

@pitrou bumping this one! Think it's ready for review if you have the time

All reactions

Sorry, something went wrong.

Uh oh!

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

zooba
zooba reviewed Apr 7, 2021
View reviewed changes

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

Sorry for the slow reviews. This looks fine to me, except it'll land in 3.10, and so the docs need to be updated to reflect that.

Sorry, something went wrong.

Uh oh!

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

All reactions
Comment thread Doc/library/pathlib.rst Resolved

Uh oh!

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

Comment thread Doc/library/pathlib.rst Resolved

Uh oh!

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

@barneygale
barneygale force-pushed the bpo-39906-pathlib-path-follow-symlinks branch from 2cc9f3b to 163742d Compare April 7, 2021 01:05
@barneygale

barneygale commented Apr 7, 2021

Copy link
Copy Markdown
Contributor Author

Thanks for the review - I've updated the .. versionchanged bits.

All reactions

Sorry, something went wrong.

Uh oh!

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

@barneygale
bpo-39906: add follow_symlinks parameter to pathlib.Path.stat() and c…
163742d
…hmod()
@zooba
zooba dismissed pitrou’s stale review April 7, 2021 15:51

Changes have been made

@zooba

zooba commented Apr 7, 2021

Copy link
Copy Markdown
Member

Just an FYI @barneygale, we squash merge at the end, so there's no need to rebase and force push PRs (merging and regular push is fine). All it does is break the review history.

All reactions

Sorry, something went wrong.

Uh oh!

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

@zooba
zooba merged commit abf9649 into python:master Apr 7, 2021
@bedevere-bot bedevere-bot removed the awaiting change review label Apr 7, 2021
@barneygale

barneygale commented Apr 7, 2021

Copy link
Copy Markdown
Contributor Author

Just an FYI @barneygale, we squash merge at the end, so there's no need to rebase and force push PRs (merging and regular push is fine). All it does is break the review history.

Good to know, thank you.

All reactions

Sorry, something went wrong.

Uh oh!

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

@alexdelorenzo alexdelorenzo mentioned this pull request Apr 16, 2021
Python 3.10 alpha 7 introduces new changes to pathlib alexdelorenzo/aiopath#4
Open
@markrwilliams markrwilliams mentioned this pull request Apr 8, 2023
pathlib.Path.owner() and .group() should accept a follow_symlinks argument #103363
Closed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@zooba zooba zooba left review comments
@pitrou pitrou Awaiting requested review from pitrou

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.

7 participants

@barneygale @the-knights-who-say-ni @bedevere-bot @csabella @russelldavis @zooba @pitrou
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.