Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

gh-145335: Fix os functions when passing fd -1 as path#145439

Merged
vstinner merged 5 commits intopython:mainfrom
vstinner:ebadf
Mar 3, 2026
Merged

gh-145335: Fix os functions when passing fd -1 as path#145439
vstinner merged 5 commits intopython:mainfrom
vstinner:ebadf

Conversation

@vstinner
Copy link
Member

@vstinnervstinner commentedMar 2, 2026
edited by bedevere-appbot
Loading

os.listdir(-1) and os.scandir(-1) now fail with OSError(errno.EBADF) rather than listing the current directory.

os.listxattr(-1) now fails with OSError(errno.EBADF) rather than listing extended attributes of the current directory.

os.listdir(-1) and os.scandir(-1) now fail with OSError(errno.EBADF)rather than listing the current directory.os.listxattr(-1) now fails with OSError(errno.EBADF) rather thanlisting extended attributes of the current directory.
@vstinnervstinner added 🔨 test-with-buildbotsTest PR w/ buildbots; report in status section and removed 🔨 test-with-buildbotsTest PR w/ buildbots; report in status section labelsMar 2, 2026
@bedevere-bot
Copy link

🤖 New build scheduled with the buildbot fleet by@vstinner for commita894262 🤖

Results will be shown at:

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

If you want to schedule another build, you need to add the🔨 test-with-buildbots label again.

@bedevere-botbedevere-bot removed the 🔨 test-with-buildbotsTest PR w/ buildbots; report in status section labelMar 2, 2026
@vstinner
Copy link
MemberAuthor

Tests failed on 5 buildbots, but failures are unrelated to this change.

buildbot/AMD64 CentOS9 NoGIL Refleaks PR

FAIL: test_free_reference (test.test_concurrent_futures.test_thread_pool.ThreadPoolExecutorTest.test_free_reference)

buildbot/AMD64 Fedora Stable Clang Installed PR
buildbot/PPC64LE Fedora Stable Clang Installed PR
buildbot/s390x Fedora Stable Clang Installed PR
buildbot/x86 Debian Installed with X PR

3 tests failed:test_datetime test_import test_interpreters. It should be fixed by commit46c5c57.

@vstinnervstinner marked this pull request as ready for reviewMarch 3, 2026 10:27
@vstinner
Copy link
MemberAuthor

vstinner commentedMar 3, 2026
edited
Loading

The PR is now ready for review.

cc@picnixz@aisk

Copy link
Member

@picnixzpicnixz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

LGTM! Are there actually other places where we use the path converter and that would be useful? (that is, do you plan to look at other modules as follow-up?)

@vstinnervstinner merged commit52c8efa intopython:mainMar 3, 2026
51 checks passed
@vstinnervstinner deleted the ebadf branchMarch 3, 2026 12:57
@vstinner
Copy link
MemberAuthor

Merged. Thanks for the review!

@vstinner
Copy link
MemberAuthor

@picnixz:

Are there actually other places where we use the path converter and that would be useful? (that is, do you plan to look at other modules as follow-up?)

I had a look and I didn't find other places with the same bug.

  • path_converter() andpath_t are specific toposixmodule.c.
  • PyObject_AsFileDescriptor() fails with ValueError if the file descriptor is negative, so check for errors usingfd == -1 orfd < 0 is correct.
  • _PyLong_FileDescriptor_Converter() callsPyObject_AsFileDescriptor().
  • Argument Clinic generatesPyObject_AsFileDescriptor() calls when usingfildes type.
  • open() callsFileIO() which also explicitly rejects negative file descriptors.
picnixz reacted with thumbs up emoji

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

Reviewers

@picnixzpicnixzpicnixz approved these changes

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

3 participants

@vstinner@bedevere-bot@picnixz

[8]ページ先頭

©2009-2026 Movatter.jp