Title: os.statx() ignores follow_symlinks=False · Issue #158998 · python/cpython · GitHub
Open Graph Title: os.statx() ignores follow_symlinks=False · Issue #158998 · python/cpython
X Title: os.statx() ignores follow_symlinks=False · Issue #158998 · python/cpython
Description: Bug report On Linux with Python 3.15, os.statx() follows symbolic links even when follow_symlinks=False is passed. A small reproducer: import os import stat import tempfile from pathlib import Path with tempfile.TemporaryDirectory() as d...
Open Graph Description: Bug report On Linux with Python 3.15, os.statx() follows symbolic links even when follow_symlinks=False is passed. A small reproducer: import os import stat import tempfile from pathlib import Path...
X Description: Bug report On Linux with Python 3.15, os.statx() follows symbolic links even when follow_symlinks=False is passed. A small reproducer: import os import stat import tempfile from pathlib import Path...
Opengraph URL: https://github.com/python/cpython/issues/158998
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"os.statx() ignores follow_symlinks=False","articleBody":"### Bug report\n\nOn Linux with Python 3.15, os.statx() follows symbolic links even when `follow_symlinks=False` is passed.\n\nA small reproducer:\n```python\nimport os\nimport stat\nimport tempfile\nfrom pathlib import Path\n\nwith tempfile.TemporaryDirectory() as directory:\n target = Path(directory) / \"target\"\n link = Path(directory) / \"link\"\n target.touch()\n link.symlink_to(target)\n\n result = os.statx(link, os.STATX_BASIC_STATS, follow_symlinks=False)\n assert stat.S_ISLNK(result.stx_mode), \"statx followed the symlink\"\n```\n\nThe assert statement is triggered because statx follows the symlink:\n```\n# /opt/bin/python3.15 -V\nPython 3.15.0rc3\n# /opt/bin/python3.15 bug.py\nTraceback (most recent call last):\n File \"/root/Python-3.15.0rc3/bug.py\", line 13, in \u003cmodule>\n assert stat.S_ISLNK(result.stx_mode), \"statx followed the symlink\"\n ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^\nAssertionError: statx followed the symlink\n```\n\n`AT_SYMLINK_NOFOLLOW` should likely be added to the statx flags when `follow_symlinks` is falsely.\n\n\n### CPython versions tested on:\n\n3.15\n\n### Operating systems tested on:\n\nLinux\n\n\u003c!-- gh-linked-prs -->\n### Linked PRs\n* gh-158999\n* gh-160996\n\u003c!-- /gh-linked-prs -->\n","author":{"url":"https://github.com/jjhelmus","@type":"Person","name":"jjhelmus"},"datePublished":"2026-10-07T23:29:56Z","url":"https://github.com/python/cpython/issues/158998"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| 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:78ac6582-37a1-0c8c-1741-118eee3c2655 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | EAA6:399E4B:38CA628:4B525C0:6B020AD4 |
| html-safe-nonce | 24b1125176f03bf4def6816bf89249bbce6bcc62873bfd7a9fe600f511144951 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFQUE2OjM5OUU0QjozOENBNjI4OjRCNTI1QzA6NkIwMjBBRDQiLCJ2aXNpdG9yX2lkIjoiMzk3NjM4MjIzMDY2Njk2NDA0IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 9b6c7b2f3dfae44f4c3fe97e9cb83a50d0238bc52615864fc6343fa9ffdfc3c0 |
| hovercard-subject-tag | issue:5753363254 |
| 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/158998/issue_layout |
| twitter:image | https://opengraph.githubassets.com/98f19277efd44575da3fca2200072ebb14ef79b524360830ede5b882f33813f0/python/cpython/issues/158998 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/98f19277efd44575da3fca2200072ebb14ef79b524360830ede5b882f33813f0/python/cpython/issues/158998 |
| og:image:alt | Bug report On Linux with Python 3.15, os.statx() follows symbolic links even when follow_symlinks=False is passed. A small reproducer: import os import stat import tempfile from pathlib import Path... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | jjhelmus |
| hostname | github.com |
| expected-hostname | github.com |
| None | 87e774ee7c6b3bee0490394e4d3e57ec9dbc956f74b87ea685dc8996c1676456 |
| 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 | 423dbb54c5e7bfecc838eb387c1435eb3d0e760d |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width