Skip to content

gh-149464: Support os.pidfd_getfd(pidfd, targetfd, flags=0) syscall#149465

Merged
vstinner merged 14 commits into
python:mainfrom
maurycy:pidfd_getfd
May 18, 2026
Merged

gh-149464: Support os.pidfd_getfd(pidfd, targetfd, flags=0) syscall#149465
vstinner merged 14 commits into
python:mainfrom
maurycy:pidfd_getfd

Conversation

@maurycy
Copy link
Copy Markdown
Contributor

@maurycy maurycy commented May 6, 2026

@maurycy maurycy changed the title gh-149464: os.pidfd_getfd gh-149464: os.pidfd_getfd(pidfd, targetfd, flags=0) May 6, 2026
@maurycy
Copy link
Copy Markdown
Contributor Author

maurycy commented May 6, 2026

cc @vstinner

@maurycy maurycy changed the title gh-149464: os.pidfd_getfd(pidfd, targetfd, flags=0) gh-149464: Support os.pidfd_getfd(pidfd, targetfd, flags=0) syscall May 6, 2026
@read-the-docs-community
Copy link
Copy Markdown

read-the-docs-community Bot commented May 6, 2026

Documentation build overview

📚 cpython-previews | 🛠️ Build #32737641 | 📁 Comparing 8d0b72b against main (947c8ea)

  🔍 Preview build  

73 files changed · + 1 added · ± 72 modified

+ Added

± Modified

Comment thread Doc/library/os.rst Outdated
Comment thread Modules/posixmodule.c
Comment thread Modules/posixmodule.c
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Comment thread Lib/test/test_os/test_posix.py Outdated
Comment thread Lib/test/test_os/test_posix.py Outdated
Comment thread Doc/library/os.rst Outdated
Comment thread Lib/test/test_os/test_posix.py Outdated
@maurycy maurycy requested review from picnixz and vstinner May 14, 2026 08:20
Copy link
Copy Markdown
Member

@vstinner vstinner left a comment

Choose a reason for hiding this comment

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

LGTM. I just suggested adding another test.

@maurycy
Copy link
Copy Markdown
Contributor Author

maurycy commented May 17, 2026

LGTM. I just suggested adding another test.

@vstinner Thank you. Could you clarify what test? Calling without a flag already:

https://github.com/python/cpython/pull/149465/changes#diff-c2ffce99c501f7f4b6bde21947391671e95f592edcdf8bddbe4706a5c59d4417R1612

Comment thread Lib/test/test_os/test_posix.py
@vstinner
Copy link
Copy Markdown
Member

@vstinner Thank you. Could you clarify what test? Calling without a flag already:

Oh I'm sorry, my comment was still a draft, I forgot to post it:

"Please add also a test on an invalid file descriptor"

Copy link
Copy Markdown
Member

@vstinner vstinner left a comment

Choose a reason for hiding this comment

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

Oh, I missed the fact that What's New in Python 3.16 is not updated.

@maurycy maurycy requested a review from AA-Turner as a code owner May 18, 2026 13:20
@vstinner vstinner merged commit a2932e9 into python:main May 18, 2026
55 checks passed
@vstinner
Copy link
Copy Markdown
Member

PR merged, thanks for your contribution! It's an interesting function! It looks way easier to use than the existing socket.send_fds() / socket.recv_fds() APIs.

@maurycy maurycy deleted the pidfd_getfd branch May 18, 2026 14:42
@bedevere-bot
Copy link
Copy Markdown

⚠️⚠️⚠️ Buildbot failure ⚠️⚠️⚠️

Hi! The buildbot AMD64 Windows PGO Tailcall 3.x (tier-1) has failed when building commit a2932e9.

What do you need to do:

  1. Don't panic.
  2. Check the buildbot page in the devguide if you don't know what the buildbots are or how they work.
  3. Go to the page of the buildbot that failed (https://buildbot.python.org/#/builders/1870/builds/673) and take a look at the build logs.
  4. Check if the failure is related to this commit (a2932e9) or if it is a false positive.
  5. If the failure is related to this commit, please, reflect that on the issue and make a new Pull Request with a fix.

You can take a look at the buildbot page here:

https://buildbot.python.org/#/builders/1870/builds/673

Summary of the results of the build (if available):

Click to see traceback logs
remote: Enumerating objects: 32, done.        
remote: Counting objects:   3% (1/27)        
remote: Counting objects:   7% (2/27)        
remote: Counting objects:  11% (3/27)        
remote: Counting objects:  14% (4/27)        
remote: Counting objects:  18% (5/27)        
remote: Counting objects:  22% (6/27)        
remote: Counting objects:  25% (7/27)        
remote: Counting objects:  29% (8/27)        
remote: Counting objects:  33% (9/27)        
remote: Counting objects:  37% (10/27)        
remote: Counting objects:  40% (11/27)        
remote: Counting objects:  44% (12/27)        
remote: Counting objects:  48% (13/27)        
remote: Counting objects:  51% (14/27)        
remote: Counting objects:  55% (15/27)        
remote: Counting objects:  59% (16/27)        
remote: Counting objects:  62% (17/27)        
remote: Counting objects:  66% (18/27)        
remote: Counting objects:  70% (19/27)        
remote: Counting objects:  74% (20/27)        
remote: Counting objects:  77% (21/27)        
remote: Counting objects:  81% (22/27)        
remote: Counting objects:  85% (23/27)        
remote: Counting objects:  88% (24/27)        
remote: Counting objects:  92% (25/27)        
remote: Counting objects:  96% (26/27)        
remote: Counting objects: 100% (27/27)        
remote: Counting objects: 100% (27/27), done.        
remote: Compressing objects:   5% (1/19)        
remote: Compressing objects:  10% (2/19)        
remote: Compressing objects:  15% (3/19)        
remote: Compressing objects:  21% (4/19)        
remote: Compressing objects:  26% (5/19)        
remote: Compressing objects:  31% (6/19)        
remote: Compressing objects:  36% (7/19)        
remote: Compressing objects:  42% (8/19)        
remote: Compressing objects:  47% (9/19)        
remote: Compressing objects:  52% (10/19)        
remote: Compressing objects:  57% (11/19)        
remote: Compressing objects:  63% (12/19)        
remote: Compressing objects:  68% (13/19)        
remote: Compressing objects:  73% (14/19)        
remote: Compressing objects:  78% (15/19)        
remote: Compressing objects:  84% (16/19)        
remote: Compressing objects:  89% (17/19)        
remote: Compressing objects:  94% (18/19)        
remote: Compressing objects: 100% (19/19)        
remote: Compressing objects: 100% (19/19), done.        
remote: Total 32 (delta 11), reused 10 (delta 8), pack-reused 5 (from 2)        
From https://github.com/python/cpython
 * branch                    main       -> FETCH_HEAD
Note: switching to 'a2932e9c95640cb98828f3e78545afacf78776f5'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by switching back to a branch.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -c with the switch command. Example:

  git switch -c <new-branch-name>

Or undo this operation with:

  git switch -

Turn off this advice by setting config variable advice.detachedHead to false

HEAD is now at a2932e9c956 gh-149464: Add `os.pidfd_getfd(pidfd, targetfd, flags=0)` function (#149465)
Switched to and reset branch 'main'

Could Not Find C:\bbarea\3.x.itamaro-win64-srv-22-aws.tailcall.pgo\build\PCbuild\*.pgc
Could Not Find C:\bbarea\3.x.itamaro-win64-srv-22-aws.tailcall.pgo\build\Lib\*.pyc
Could Not Find C:\bbarea\3.x.itamaro-win64-srv-22-aws.tailcall.pgo\build\PCbuild\*.pgc
Could Not Find C:\bbarea\3.x.itamaro-win64-srv-22-aws.tailcall.pgo\build\Lib\*.pyc
Could Not Find C:\bbarea\3.x.itamaro-win64-srv-22-aws.tailcall.pgo\build\Lib\*.pyc
The system cannot find the file specified.
Could Not Find C:\bbarea\3.x.itamaro-win64-srv-22-aws.tailcall.pgo\build\PCbuild\python*.zip

Could Not Find C:\bbarea\3.x.itamaro-win64-srv-22-aws.tailcall.pgo\build\Lib\*.pyc
The system cannot find the file specified.
Could Not Find C:\bbarea\3.x.itamaro-win64-srv-22-aws.tailcall.pgo\build\PCbuild\python*.zip

@vstinner
Copy link
Copy Markdown
Member

Hi! The buildbot AMD64 Windows PGO Tailcall 3.x (tier-1) has failed when building commit a2932e9.

It's an unrelated failure: #148255 (comment).

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add os.pidfd_getfd(pidfd, targetfd, flags=0) function

4 participants