[issue46606] Large C stack usage of os.getgroups() and os.setgroups()

STINNER Victor report at bugs.python.org
Sat Feb 26 18:16:35 EST 2022


STINNER Victor <vstinner at python.org> added the comment:

> NGROUPS_MAX is 65536 and sizeof(gid_t) is 4 on Ubuntu 20.04, so grouplist is 262144bytes.

Oops, that's a lot! Nicely spotted! Yeah, it's perfectly fine to allocate a temporary array on the heap memory. There is no need to micro-optimize this function.

Maybe the code was written when NGROUPS_MAX was way smaller (64?).

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue46606>
_______________________________________


More information about the Python-bugs-list mailing list