### Bug report On Linux with Python 3.15, os.statx() follows symbolic links even when `follow_symlinks=False` is passed. A small reproducer: ```python import os import stat import tempfile from pathlib import Path with tempfile.TemporaryDirectory() as directory: target = Path(directory) / "target" link = Path(directory) / "link" target.touch() link.symlink_to(target) result = os.statx(link, os.STATX_BASIC_STATS, follow_symlinks=False) assert stat.S_ISLNK(result.stx_mode), "statx followed the symlink" ``` The assert statement is triggered because statx follows the symlink: ``` # /opt/bin/python3.15 -V Python 3.15.0rc3 # /opt/bin/python3.15 bug.py Traceback (most recent call last): File "/root/Python-3.15.0rc3/bug.py", line 13, in <module> assert stat.S_ISLNK(result.stx_mode), "statx followed the symlink" ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^ AssertionError: statx followed the symlink ``` `AT_SYMLINK_NOFOLLOW` should likely be added to the statx flags when `follow_symlinks` is falsely. ### CPython versions tested on: 3.15 ### Operating systems tested on: Linux <!-- gh-linked-prs --> ### Linked PRs * gh-158999 <!-- /gh-linked-prs -->
Activity
cmaloney commentedon Oct 8, 2026
cc: @jbosboom