diff options
author | Raymond Hettinger <python@rcn.com> | 2003-10-12 19:09:37 (GMT) |
---|---|---|
committer | Raymond Hettinger <python@rcn.com> | 2003-10-12 19:09:37 (GMT) |
commit | 8ae468965700fd9900efc28bff8fa2015dae2bef (patch) | |
tree | 1f3545b2d2a3ad8b7d5692a7f84daa88d850b29c /Modules/posixmodule.c | |
parent | cb2da43db8943e9e7b1d900bce1d6416339d6f64 (diff) | |
download | cpython-8ae468965700fd9900efc28bff8fa2015dae2bef.zip cpython-8ae468965700fd9900efc28bff8fa2015dae2bef.tar.gz cpython-8ae468965700fd9900efc28bff8fa2015dae2bef.tar.bz2 |
Simplify and speedup uses of Py_BuildValue():
* Py_BuildValue("(OOO)",a,b,c) --> PyTuple_Pack(3,a,b,c)
* Py_BuildValue("()",a) --> PyTuple_New(0)
* Py_BuildValue("O", a) --> Py_INCREF(a)
Diffstat (limited to 'Modules/posixmodule.c')
-rw-r--r-- | Modules/posixmodule.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c index fa8215a..f5787c3 100644 --- a/Modules/posixmodule.c +++ b/Modules/posixmodule.c @@ -3376,10 +3376,10 @@ _PyPopen(char *cmdstring, int mode, int n, int bufsize) { if ((p_f[2] = PyFile_FromFile(p_s[2], cmdstring, rd_mode, _PyPclose)) != NULL) PyFile_SetBufSize(p_f[0], bufsize); - f = Py_BuildValue("OOO", p_f[0], p_f[1], p_f[2]); + f = PyTuple_Pack(3, p_f[0], p_f[1], p_f[2]); } else - f = Py_BuildValue("OO", p_f[0], p_f[1]); + f = PyTuple_Pack(2, p_f[0], p_f[1]); /* * Insert the files we've created into the process dictionary @@ -4069,7 +4069,7 @@ _PyPopen(char *cmdstring, int mode, int n) if (n != 4) CloseHandle(hChildStderrRdDup); - f = Py_BuildValue("OO",p1,p2); + f = PyTuple_Pack(2,p1,p2); Py_XDECREF(p1); Py_XDECREF(p2); file_count = 2; @@ -4101,7 +4101,7 @@ _PyPopen(char *cmdstring, int mode, int n) PyFile_SetBufSize(p1, 0); PyFile_SetBufSize(p2, 0); PyFile_SetBufSize(p3, 0); - f = Py_BuildValue("OOO",p1,p2,p3); + f = PyTuple_Pack(3,p1,p2,p3); Py_XDECREF(p1); Py_XDECREF(p2); Py_XDECREF(p3); |