File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -83,6 +83,9 @@ Extensions
8383Library
8484-------
8585
86+ - Issue #9604: posix.initgroups() encodes the username using the fileystem
87+ encoding and surrogateescape error handler. Patch written by David Watson.
88+
8689- Issue #9603: posix.ttyname() and posix.ctermid() decode the terminal name
8790 using the filesystem encoding and surrogateescape error handler. Patch
8891 written by David Watson.
Original file line number Diff line number Diff line change @@ -4249,13 +4249,19 @@ group id.");
42494249static PyObject *
42504250posix_initgroups (PyObject * self , PyObject * args )
42514251{
4252+ PyObject * oname ;
42524253 char * username ;
4254+ int res ;
42534255 long gid ;
42544256
4255- if (!PyArg_ParseTuple (args , "sl:initgroups" , & username , & gid ))
4257+ if (!PyArg_ParseTuple (args , "O&l:initgroups" ,
4258+ PyUnicode_FSConverter , & oname , & gid ))
42564259 return NULL ;
4260+ username = PyBytes_AS_STRING (oname );
42574261
4258- if (initgroups (username , (gid_t ) gid ) == -1 )
4262+ res = initgroups (username , (gid_t ) gid );
4263+ Py_DECREF (oname );
4264+ if (res == -1 )
42594265 return PyErr_SetFromErrno (PyExc_OSError );
42604266
42614267 Py_INCREF (Py_None );
You can’t perform that action at this time.
0 commit comments