diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2011-01-02 20:04:52 (GMT) |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2011-01-02 20:04:52 (GMT) |
commit | b06146159600b5d9daaf1caf49db43b627ff759f (patch) | |
tree | f9e711d2aad67713bd1e31f128bcdfdd223ccead /Modules/posixmodule.c | |
parent | f11d1832ec6aa06b3eeea67724d9d1ae42ea88a2 (diff) | |
download | cpython-b06146159600b5d9daaf1caf49db43b627ff759f.zip cpython-b06146159600b5d9daaf1caf49db43b627ff759f.tar.gz cpython-b06146159600b5d9daaf1caf49db43b627ff759f.tar.bz2 |
Issue #4662: os.tempnam(), os.tmpfile() and os.tmpnam() now raise a py3k
DeprecationWarning.
Diffstat (limited to 'Modules/posixmodule.c')
-rw-r--r-- | Modules/posixmodule.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c index 0d7ca72..fcc73ad 100644 --- a/Modules/posixmodule.c +++ b/Modules/posixmodule.c @@ -7295,6 +7295,10 @@ posix_tempnam(PyObject *self, PyObject *args) "tempnam is a potential security risk to your program") < 0) return NULL; + if (PyErr_WarnPy3k("tempnam has been removed in 3.x; " + "use the tempfile module", 1) < 0) + return NULL; + #ifdef MS_WINDOWS name = _tempnam(dir, pfx); #else @@ -7319,6 +7323,10 @@ posix_tmpfile(PyObject *self, PyObject *noargs) { FILE *fp; + if (PyErr_WarnPy3k("tmpfile has been removed in 3.x; " + "use the tempfile module", 1) < 0) + return NULL; + fp = tmpfile(); if (fp == NULL) return posix_error(); @@ -7342,6 +7350,10 @@ posix_tmpnam(PyObject *self, PyObject *noargs) "tmpnam is a potential security risk to your program") < 0) return NULL; + if (PyErr_WarnPy3k("tmpnam has been removed in 3.x; " + "use the tempfile module", 1) < 0) + return NULL; + #ifdef USE_TMPNAM_R name = tmpnam_r(buffer); #else |