This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: get{pw,gr}{nam,[ug]id}() calls are not re-entrant
Type: behavior Stage: resolved
Components: Library (Lib) Versions: Python 3.7
Status: closed Resolution: fixed
Dependencies: Superseder: Release GIL for grp.getgr{nam,gid} and pwd.getpw{nam,uid}
View: 33625
Assigned To: Nosy List: christian.heimes, dhduvall
Priority: normal Keywords:

Created on 2009-07-20 22:54 by dhduvall, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (3)
msg90743 - (view) Author: Danek Duvall (dhduvall) Date: 2009-07-20 22:54
In tracking down

        6861990 getgrnam_r() str2group() function makes decisions based
on return value before it's set

(viewable on, I noted that the pwd and grp modules
don't use the MT-safe interfaces to the password and group name service
tables.  The _r() interfaces have been around for a long time, are
standard, and should be used if at all possible.  That said, I can't
imagine it's terribly likely that people will go to the lengths
necessary to actually put multiple calls in flight at the same time in
CPython, but should it ever become easy to put this code into concurrent
threads, it'll likely fall over.
msg109947 - (view) Author: Mark Lawrence (BreamoreBoy) * Date: 2010-07-10 23:59
Is this an issue that should be addressed?
msg404734 - (view) Author: Christian Heimes (christian.heimes) * (Python committer) Date: 2021-10-22 09:30
The problem was fixed a couple of years ago. Python uses the reentrant functions since commit 23e65b25557f957af840cf8fe68e80659ce28629 / GH-7081.
Date User Action Args
2022-04-11 14:56:51adminsetgithub: 50778
2021-10-22 09:33:40iritkatrielsetversions: + Python 3.7, - Python 3.1, Python 2.7, Python 3.2
2021-10-22 09:30:19christian.heimessetstatus: open -> closed

superseder: Release GIL for grp.getgr{nam,gid} and pwd.getpw{nam,uid}
versions: + Python 3.1, Python 2.7, Python 3.2, - Python 3.9, Python 3.10, Python 3.11
nosy: + christian.heimes

messages: + msg404734
resolution: fixed
stage: resolved
2021-10-22 09:30:07iritkatrielsetstage: test needed -> (no value)
2021-10-22 09:29:48iritkatrielsetversions: + Python 3.9, Python 3.10, Python 3.11, - Python 3.1, Python 2.7, Python 3.2
2014-02-03 19:21:54BreamoreBoysetnosy: - BreamoreBoy
2010-07-10 23:59:19BreamoreBoysetversions: + Python 3.1, Python 2.7, Python 3.2, - Python 2.6
nosy: + BreamoreBoy

messages: + msg109947

stage: test needed
2009-07-20 22:54:44dhduvallcreate