python / python/cpython

Add ability to filter out results of `shutil.which` by `os.stat_result.st_flags`

Open
#100,827 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

stdlib type-feature
Dominant language
Python
Stars
77.2k
Forks
36k
PR merge metrics
PR metrics pending

Description

Feature or enhancement

Add ability to filter out results of https://docs.python.org/3/library/shutil.html#shutil.which by https://docs.python.org/3/library/os.html#os.stat_result.st_flags

Pitch

Basically, it is desirable to call/use a version of an installed executable that is not restricted by macOS SIP such as when modifying linker environment variables.

Previous discussion

Somewhat related https://github.com/python/cpython/issues/76528

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the shutil.which and os.stat_result.st_flags documentation and review the linked macOS SIP and previous-discussion issues. Determine the intended filtering interface and platform-specific behavior, then verify that executable selection excludes the requested st_flags cases without changing other platforms.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
operating-systems
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.