]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
gh-94518: [_posixsubprocess] Replace variable validity flags with reserved values...
authorOleg Iarygin <oleg@arhadthedev.net>
Sat, 14 Jan 2023 20:11:04 +0000 (00:11 +0400)
committerGitHub <noreply@github.com>
Sat, 14 Jan 2023 20:11:04 +0000 (12:11 -0800)
commit124af17b6e49f0f22fbe646fb57800393235d704
treed85e0b7535af6ba3fe81193a6d935697334a963d
parent49cae39ef020eaf242607bb2d2d193760b9855a6
gh-94518: [_posixsubprocess] Replace variable validity flags with reserved values (#94687)

Have _posixsubprocess.c stop using boolean flags to say if gid and uid values were supplied and action is required.  Such an implicit "either initialized or look somewhere else" confused both the reader (another mental connection to constantly track between functions) and a compiler (warnings on potentially uninitialized variables being passed). Instead, we can utilize a special group/user id as a flag value -1 defined by POSIX but used nowhere else. Namely:

gid: call_setgid = False → gid = -1

uid: call_setuid = False → uid = -1

groups: call_setgroups = False → groups = NULL (obtained with (groups_list != Py_None) ? groups : NULL)

This PR is required for #94519.
Misc/NEWS.d/next/Library/2022-07-22-13-38-37.gh-issue-94518._ZP0cz.rst [new file with mode: 0644]
Modules/_posixsubprocess.c