Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 830a4bc

Browse files
committed
os.environ contains PyUnicode instances and not PyString instances
1 parent b2b6262 commit 830a4bc

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

Modules/posixmodule.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3026,7 +3026,7 @@ posix_execve(PyObject *self, PyObject *args)
30263026
/* Omit Pseudo-Env Vars that Would Confuse Programs if Passed On */
30273027
if (stricmp(k, "BEGINLIBPATH") != 0 && stricmp(k, "ENDLIBPATH") != 0) {
30283028
#endif
3029-
len = PyString_Size(key) + PyString_Size(val) + 2;
3029+
len = PyUnicode_GetSize(key) + PyUnicode_GetSize(val) + 2;
30303030
p = PyMem_NEW(char, len);
30313031
if (p == NULL) {
30323032
PyErr_NoMemory();
@@ -3256,7 +3256,7 @@ posix_spawnve(PyObject *self, PyObject *args)
32563256
{
32573257
goto fail_2;
32583258
}
3259-
len = PyString_Size(key) + PyString_Size(val) + 2;
3259+
len = PyUnicode_GetSize(key) + PyUnicode_GetSize(val) + 2;
32603260
p = PyMem_NEW(char, len);
32613261
if (p == NULL) {
32623262
PyErr_NoMemory();
@@ -3489,7 +3489,7 @@ posix_spawnvpe(PyObject *self, PyObject *args)
34893489
{
34903490
goto fail_2;
34913491
}
3492-
len = PyString_Size(key) + PyString_Size(val) + 2;
3492+
len = PyUnicode_GetSize(key) + PyUnicode_GetSize(val) + 2;
34933493
p = PyMem_NEW(char, len);
34943494
if (p == NULL) {
34953495
PyErr_NoMemory();

0 commit comments

Comments
 (0)