Skip to content

gh-126253: Ignore unknown Windows file attribute bits in scandir test - #156305

Open
Wanbinyu wants to merge 7 commits into
python:mainfrom
Wanbinyu:gh-126253-test-os-file-attributes
Open

Wanbinyu wants to merge 7 commits into
python:mainfrom
Wanbinyu:gh-126253-test-os-file-attributes

Conversation

@Wanbinyu

@Wanbinyu Wanbinyu commented Aug 24, 2026 •

Copy link
Copy Markdown

For #126253.

os.scandir().stat() and os.stat() can return different values for st_file_attributes when NTFS reports bits that are not exposed by Python's stat module. Limit the scandir test comparison to the public stat.FILE_ATTRIBUTE_* bits, while continuing to compare every public bit strictly.

The regression test constructs os.stat_result values with the reported 0x10000000 bit so the behavior is covered even on Windows builds where the filesystem does not naturally return it. It also verifies that a difference in FILE_ATTRIBUTE_READONLY still fails the comparison.

Tests:

  • PCbuild\amd64\python_d.exe -m test test_os.test_os -m "*attributes*" -v
  • PCbuild\amd64\python_d.exe -m test -v test_os
  • PCbuild\amd64\python_d.exe Tools\patchcheck\patchcheck.py

This contribution was prepared with assistance from OpenAI Codex. I reviewed and tested the resulting changes.

@python-cla-bot

python-cla-bot Bot commented Aug 24, 2026 •

Copy link
Copy Markdown

All commit authors signed the Contributor License Agreement.

CLA signed

@bedevere-app bedevere-app Bot added the tests Tests in the Lib/test dir label Aug 24, 2026
@bedevere-app

bedevere-app Bot commented Aug 24, 2026

Copy link
Copy Markdown

Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool.

If this change has little impact on Python users, wait for a maintainer to apply the skip news label instead.

@hugovk

This comment was marked as resolved.

@hugovk

This comment was marked as resolved.

@bedevere-bot

Copy link
Copy Markdown

🤖 New build scheduled with the buildbot fleet by @hugovk for commit 744f998 🤖

Results will be shown at:

https://buildbot.python.org/all/#/grid?branch=refs%2Fpull%2F156305%2Fmerge

The command will test the builders whose names match following regular expression: ARM64 Windows( Non-Debug)? PR

The builders matched are:

  • ARM64 Windows Non-Debug PR
  • ARM64 Windows PR

Comment thread Lib/test/test_os/test_os.py Resolved
Comment thread Lib/test/test_os/test_os.py Resolved
Comment thread Lib/test/test_os/test_os.py Resolved
Comment thread Lib/test/test_os/test_os.py Resolved
Comment thread Lib/test/test_os/test_os.py Resolved
Comment thread Lib/test/test_os/test_os.py Resolved
hugovk and others added 4 commits November 12, 2026 16:04
… NEWS

Co-authored-by: Victor Stinner <vstinner@python.org>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
@hugovk

hugovk commented Nov 12, 2026

Copy link
Copy Markdown
Member

!buildbot ARM64 Windows( Non-Debug)? PR

@bedevere-bot

Copy link
Copy Markdown

🤖 New build scheduled with the buildbot fleet by @hugovk for commit 6928e67 🤖

Results will be shown at:

https://buildbot.python.org/all/#/grid?branch=refs%2Fpull%2F156305%2Fmerge

The command will test the builders whose names match following regular expression: ARM64 Windows( Non-Debug)? PR

The builders matched are:

  • ARM64 Windows Non-Debug PR
  • ARM64 Windows PR

@hugovk

hugovk commented Nov 12, 2026

Copy link
Copy Markdown
Member

I applied the suggested changes, and buildbots passed.

@vstinner @zware Please review, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting review tests Tests in the Lib/test dir

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants