Title: Add `follow_symlinks` to `os.path.exists()` · Issue #117705 · python/cpython · GitHub
Open Graph Title: Add `follow_symlinks` to `os.path.exists()` · Issue #117705 · python/cpython
X Title: Add `follow_symlinks` to `os.path.exists()` · Issue #117705 · python/cpython
Description: Feature or enhancement Proposal: Because we have os.path.exists() & os.path.lexists(), it might make sense to add a follow_symlinks argument to the former: -def exists(path): +def exists(path, *, follow_symlinks=True): """Test whether a ...
Open Graph Description: Feature or enhancement Proposal: Because we have os.path.exists() & os.path.lexists(), it might make sense to add a follow_symlinks argument to the former: -def exists(path): +def exists(path, *, f...
X Description: Feature or enhancement Proposal: Because we have os.path.exists() & os.path.lexists(), it might make sense to add a follow_symlinks argument to the former: -def exists(path): +def exists(path, ...
Opengraph URL: https://github.com/python/cpython/issues/117705
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Add `follow_symlinks` to `os.path.exists()`","articleBody":"# Feature or enhancement\r\n\r\n### Proposal:\r\n\r\nBecause we have `os.path.exists()` \u0026 `os.path.lexists()`, it might make sense to add a `follow_symlinks` argument to the former:\r\n\r\n```diff\r\n-def exists(path):\r\n+def exists(path, *, follow_symlinks=True):\r\n \"\"\"Test whether a path exists. Returns False for broken symbolic links\"\"\"\r\n try:\r\n- os.stat(path)\r\n+ os.stat(path, follow_symlinks=follow_symlinks)\r\n except (OSError, ValueError):\r\n return False\r\n return True\r\n```\r\n\r\nThis matches `pathlib.Path.exists()` ~(as well as `os.stat()` \u0026 `os.chmod()`).~ ~Also, it looks like `pathlib.Path` doesn't have an `lexists()` function.~ (but that's less explicit and so unnecessary, see https://github.com/python/cpython/pull/21157#issuecomment-765092285)\r\n\r\n~_Note: this argument also needs to be added to `nt._path_exists()`._~ Done.\r\n\r\n### Has this already been discussed elsewhere?\r\n\r\nThis is a minor feature, which does not need previous discussion elsewhere\r\n\r\n### Links to previous discussion of this feature:\r\n\r\n_No response_\r\n\r\n\u003c!-- gh-linked-prs --\u003e\r\n### Linked PRs\r\n* gh-117729\r\n\u003c!-- /gh-linked-prs --\u003e\r\n","author":{"url":"https://github.com/nineteendo","@type":"Person","name":"nineteendo"},"datePublished":"2024-04-10T06:01:52.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":21},"url":"https://github.com/117705/cpython/issues/117705"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:fe5e9c54-1f09-cbcf-4b71-a4910a725a58 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | EBDC:284E5C:3DD409:55F4F4:696A6A3B |
| html-safe-nonce | 4c4c189da150d568f3bd919bb7c549e499185d346e99264a65abe6ee3ed704ec |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFQkRDOjI4NEU1QzozREQ0MDk6NTVGNEY0OjY5NkE2QTNCIiwidmlzaXRvcl9pZCI6IjM4NjA2ODkyMDg3MTEyMTE1NzkiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 451ca4bbb21cc27c680fb3f42a7be456a7dc6bf89120900476c72909be6afb8b |
| hovercard-subject-tag | issue:2234818173 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python/cpython/117705/issue_layout |
| twitter:image | https://opengraph.githubassets.com/c41e82d41f24f78080eb9952ab503206faea56b30749490718f1eada2b9df576/python/cpython/issues/117705 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/c41e82d41f24f78080eb9952ab503206faea56b30749490718f1eada2b9df576/python/cpython/issues/117705 |
| og:image:alt | Feature or enhancement Proposal: Because we have os.path.exists() & os.path.lexists(), it might make sense to add a follow_symlinks argument to the former: -def exists(path): +def exists(path, *, f... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | nineteendo |
| hostname | github.com |
| expected-hostname | github.com |
| None | 6fea32d5b7276b841b7a803796d9715bc6cfb31ed549fdf9de2948ac25d12ba6 |
| turbo-cache-control | no-preview |
| go-import | github.com/python/cpython git https://github.com/python/cpython.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 81598961 |
| octolytics-dimension-repository_nwo | python/cpython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 81598961 |
| octolytics-dimension-repository_network_root_nwo | python/cpython |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | f2d9f6432a5a115ec709295ae70623f33bb80aee |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width