The Wayback Machine - https://web.archive.org/web/20220711063302/https://github.com/python/cpython/pull/94687
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gh-94518: [_posixsubprocess] Replace variable validity flags with reserved values #94687

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

arhadthedev
Copy link
Contributor

@arhadthedev arhadthedev commented Jul 8, 2022

Currently, Modules/_posixsubprocess.c uses variables supplied with flags of whether the variable was initialized with a value. However it confuses both a reader (another mental connection required to constantly keep in mind across functions) and a compiler (warnings on potentially uninitialized variables). We can use a fact that these variables are of types with special values not used by anything else. This PR replaces the dedicated flags with these token values.

Namely:

  • gid: call_setgid = Falsegid = -1
  • uid: call_setuid = Falseuid = -1
  • groups: call_setgroups = Falsegroups = NULL (obtained with (groups_list != Py_None) ? groups : NULL)

This PR is required for gh-94519.


PS.: @tiran I applied your suggestion from gh-94519 as this, separate PR to keep that one limited in scope and reviewable.

@arhadthedev arhadthedev requested a review from gpshead as a code owner Jul 8, 2022
@arhadthedev arhadthedev changed the title gh-94518: [_posixsubprocess] Replace each variable validity flag with a reserved value of that variable gh-94518: [_posixsubprocess] Replace variable validity flags with reserved values Jul 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants