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

2022-02-26 Thread STINNER Victor
STINNER Victor 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.

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

2022-02-26 Thread STINNER Victor
STINNER Victor added the comment: New changeset e02c47528b31f513d5f5d6eb91b8c9714134cea2 by Victor Stinner in branch 'main': bpo-46606: os.getgroups() doesn't overallocate (GH-31569) https://github.com/python/cpython/commit/e02c47528b31f513d5f5d6eb91b8c9714134cea2 --

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

2022-02-25 Thread STINNER Victor
Change by STINNER Victor : -- pull_requests: +29691 pull_request: https://github.com/python/cpython/pull/31569 ___ Python tracker ___

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

2022-02-24 Thread Inada Naoki
Inada Naoki added the comment: New changeset ad6c7003e38a9f8bdf8d865fb5fa0f3c03690315 by Inada Naoki in branch 'main': bpo-46606: Remove redundant +1. (GH-31561) https://github.com/python/cpython/commit/ad6c7003e38a9f8bdf8d865fb5fa0f3c03690315 --

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

2022-02-24 Thread Inada Naoki
Change by Inada Naoki : -- pull_requests: +29684 pull_request: https://github.com/python/cpython/pull/31561 ___ Python tracker ___

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

2022-02-23 Thread STINNER Victor
STINNER Victor added the comment: > n++; // Avoid malloc(0) > grouplist = PyMem_New(gid_t, n+1); FYI PyMem_New(0) is well specified and doesn't return NULL: https://docs.python.org/dev/c-api/memory.html#c.PyMem_Malloc -- nosy: +vstinner ___

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

2022-02-21 Thread Inada Naoki
Change by Inada Naoki : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker ___ ___

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

2022-02-21 Thread Inada Naoki
Inada Naoki added the comment: New changeset 74127b89a8224d021fc76f679422b76510844ff9 by Inada Naoki in branch 'main': bpo-46606: Reduce stack usage of getgroups and setgroups (GH-31073) https://github.com/python/cpython/commit/74127b89a8224d021fc76f679422b76510844ff9 --

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

2022-02-01 Thread Dong-hee Na
Change by Dong-hee Na : -- nosy: +corona10 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

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

2022-02-01 Thread Inada Naoki
Change by Inada Naoki : -- keywords: +patch pull_requests: +29257 stage: -> patch review pull_request: https://github.com/python/cpython/pull/31073 ___ Python tracker ___

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

2022-02-01 Thread Inada Naoki
New submission from Inada Naoki : I checked stack usage for bpo-46600 and found this two functions use a lot of stack. os_setgroups: 262200 bytes os_getgroups_impl: 262184 bytes Both function has local variable like this: gid_t grouplist[MAX_GROUPS]; MAX_GROUPS is defined as: ```