From aece8f3fd203ba046dc3c6a879a448de0a51be8d Mon Sep 17 00:00:00 2001 From: Moshe Zadka Date: Sat, 31 Mar 2001 08:10:03 +0000 Subject: - posixmodule.c - Add missing prototypes in for SunOS 4.1.4, plug memory leak - #125891 - posixmodule.c - os.popen2,3 and 4 leaked file objects on Windows. - #128053 - posixmodule.c - #ifdef for including "tmpfile" in the posix_methods[] array was wrong -- should be HAVE_TMPFILE --- Misc/NEWS | 7 +++++++ Modules/posixmodule.c | 13 +++++++++++-- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS index 5968689..575bee5 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -76,6 +76,13 @@ http://sourceforge.net/tracker/index.php?func=detail&aid=&group_id=5470&atid - #232787 -- Modules/timemodule.c, Python/errors.c, Objects/intobject.c +- posixmodule.c - Add missing prototypes in for SunOS 4.1.4, plug memory leak + +- #125891 - posixmodule.c - os.popen2,3 and 4 leaked file objects on Windows. + +- #128053 - posixmodule.c - #ifdef for including "tmpfile" in the + posix_methods[] array was wrong -- should be HAVE_TMPFILE + What's New in Python 2.0? ========================= diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c index 8544f6a..3359741 100644 --- a/Modules/posixmodule.c +++ b/Modules/posixmodule.c @@ -113,6 +113,9 @@ corresponding Unix manual entries for more information on calls."; extern int rename(const char *, const char *); extern int pclose(FILE *); extern int fclose(FILE *); +extern int fsync(int); +extern int lstat(const char *, struct stat *); +extern int symlink(const char *, const char *); #endif #ifdef NeXT @@ -2509,6 +2512,8 @@ _PyPopen(char *cmdstring, int mode, int n) CloseHandle(hChildStderrRdDup); f = Py_BuildValue("OO",p1,p2); + Py_XDECREF(p1); + Py_XDECREF(p2); file_count = 2; break; } @@ -2539,6 +2544,9 @@ _PyPopen(char *cmdstring, int mode, int n) PyFile_SetBufSize(p2, 0); PyFile_SetBufSize(p3, 0); f = Py_BuildValue("OOO",p1,p2,p3); + Py_XDECREF(p1); + Py_XDECREF(p2); + Py_XDECREF(p3); file_count = 3; break; } @@ -5348,7 +5356,7 @@ static PyMethodDef posix_methods[] = { #ifdef HAVE_STATVFS {"statvfs", posix_statvfs, METH_VARARGS, posix_statvfs__doc__}, #endif -#ifdef HAVE_TMPNAM +#ifdef HAVE_TMPFILE {"tmpfile", posix_tmpfile, METH_VARARGS, posix_tmpfile__doc__}, #endif #ifdef HAVE_TEMPNAM @@ -5569,6 +5577,7 @@ INITFUNC(void) PyDict_SetItemString(d, "error", PyExc_OSError); #ifdef HAVE_PUTENV - posix_putenv_garbage = PyDict_New(); + if (posix_putenv_garbage == NULL) + posix_putenv_garbage = PyDict_New(); #endif } -- cgit v0.12