Skip to content

gh-151427: add 'not macOS' restriction on availabitity state of 7 functions in os module.#151537

Merged
ned-deily merged 5 commits into
python:mainfrom
YvesDup:os-module-add-not-MacOSX-availability
Jun 19, 2026
Merged

gh-151427: add 'not macOS' restriction on availabitity state of 7 functions in os module.#151537
ned-deily merged 5 commits into
python:mainfrom
YvesDup:os-module-add-not-MacOSX-availability

Conversation

@YvesDup

@YvesDup YvesDup commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

These functions are not available on macOS.

  • getresgid, setresgid
  • getresuid, setresuid
  • pipe2
  • posix_fallocate
  • posix_fadvise

These updates should be backport to 3.13, 3.14 and 3.15 versions. The functions were added in 3.2 and 3.3 versions.

@bedevere-app bedevere-app Bot added docs Documentation in the Doc dir skip news labels Jun 16, 2026
@github-project-automation github-project-automation Bot moved this to Todo in Docs PRs Jun 16, 2026
@YvesDup YvesDup changed the title gh-151427: add **not macOS* restriction on availabitity state of 7 functions in os module. gh-151427: add 'not macOS' restriction on availabitity state of 7 functions in os module. Jun 16, 2026
@read-the-docs-community

read-the-docs-community Bot commented Jun 16, 2026

Copy link
Copy Markdown

@vstinner vstinner left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM, but I don't have access to macOS to double check.

@StanFromIreland StanFromIreland requested a review from a team June 16, 2026 19:52
@YvesDup

YvesDup commented Jun 17, 2026

Copy link
Copy Markdown
Contributor Author

Helper to validate on macOS

import os
import sys

funcs = ('getresgid', 'setresgid',
        'getresuid', 'setresuid',
        'pipe2',
        'posix_fallocate',
        'posix_fadvise',
        'getpid' # this function exists
        )

def test_missing_os_functions_from_macos():
    n = 0
    for f in funcs:
        try:
            os.__dict__[f]
        except KeyError:
            n += 1

    if sys.platform == 'darwin':
        assert n == len(funcs[:-1])
        print(f"Okay on {sys.platform}")
    elif sys.platform == 'linux':
        assert n == 0
        print(f"Okay on {sys.platform}")

if __name__ == '__main__':
    test_missing_os_functions_from_macos()

@ned-deily ned-deily left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for the PR. It looks OK as far as it goes. But, since we now document iOS availabilities as well as macOS, we should include not iOS on these. At the os module level, iOS is very similar to macOS with some more restrictions. But with a quick check in the iOS simulator, it appears that these seven are also not available on iOS. @freakboy3742, do you agree?

@freakboy3742

Copy link
Copy Markdown
Contributor

Correct - these methods aren't available on iOS, so flagging them as "not iOS" as well would make sense to me.

@YvesDup

YvesDup commented Jun 18, 2026

Copy link
Copy Markdown
Contributor Author

While checking all not iOS and not macOS avalaibilities in os module functions, the os.plock seems to be not available in macOS ... neither in Linux.
What are OS where os.plock is really available ? Should I open a new issue ?

@vstinner

Copy link
Copy Markdown
Member

You can update plock() availability documentation in the same PR.

@YvesDup

YvesDup commented Jun 18, 2026

Copy link
Copy Markdown
Contributor Author

I did not add not linux entry on plock availability because I can only check with Ubuntu. This is not represensative enough of all linux distribs.

Comment thread Doc/library/os.rst Outdated
@ned-deily ned-deily merged commit da69fcf into python:main Jun 19, 2026
30 checks passed
@github-project-automation github-project-automation Bot moved this from Todo to Done in Docs PRs Jun 19, 2026
@ned-deily ned-deily added needs backport to 3.13 bugs and security fixes needs backport to 3.14 bugs and security fixes needs backport to 3.15 pre-release feature fixes, bugs and security fixes labels Jun 19, 2026
@miss-islington-app

Copy link
Copy Markdown

Thanks @YvesDup for the PR, and @ned-deily for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13.
🐍🍒⛏🤖

@miss-islington-app

Copy link
Copy Markdown

Thanks @YvesDup for the PR, and @ned-deily for merging it 🌮🎉.. I'm working now to backport this PR to: 3.14.
🐍🍒⛏🤖

@miss-islington-app

Copy link
Copy Markdown

Thanks @YvesDup for the PR, and @ned-deily for merging it 🌮🎉.. I'm working now to backport this PR to: 3.15.
🐍🍒⛏🤖

@bedevere-app

bedevere-app Bot commented Jun 19, 2026

Copy link
Copy Markdown

GH-151697 is a backport of this pull request to the 3.13 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.13 bugs and security fixes label Jun 19, 2026
@bedevere-app

bedevere-app Bot commented Jun 19, 2026

Copy link
Copy Markdown

GH-151698 is a backport of this pull request to the 3.14 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.14 bugs and security fixes label Jun 19, 2026
@bedevere-app

bedevere-app Bot commented Jun 19, 2026

Copy link
Copy Markdown

GH-151699 is a backport of this pull request to the 3.15 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.15 pre-release feature fixes, bugs and security fixes label Jun 19, 2026
ned-deily pushed a commit that referenced this pull request Jun 19, 2026
…ability state of some functions in `os` module. (GH-151537) (#151697)

(cherry picked from commit da69fcf)
Co-authored-by: Duprat <yduprat@gmail.com>
ned-deily pushed a commit that referenced this pull request Jun 19, 2026
…ability state of some functions in `os` module. (GH-151537) (#151698)

(cherry picked from commit da69fcf)
Co-authored-by: Duprat <yduprat@gmail.com>
ned-deily pushed a commit that referenced this pull request Jun 19, 2026
…ability state of some functions in `os` module. (GH-151537) (#151699)

(cherry picked from commit da69fcf)
Co-authored-by: Duprat <yduprat@gmail.com>
@YvesDup YvesDup deleted the os-module-add-not-MacOSX-availability branch June 19, 2026 12:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Documentation in the Doc dir skip news

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

4 participants