summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@haypocalc.com>2011-11-24 12:53:38 (GMT)
committerVictor Stinner <victor.stinner@haypocalc.com>2011-11-24 12:53:38 (GMT)
commit984890fcbbb2bb9d7168fd78a1383804593c3fd3 (patch)
tree6bfdaf51f6d170bca2fad95b42b2d1aabb0dfe25 /Modules
parent1518e8713d1e372284c653f254fb29cecc66d764 (diff)
downloadcpython-984890fcbbb2bb9d7168fd78a1383804593c3fd3.zip
cpython-984890fcbbb2bb9d7168fd78a1383804593c3fd3.tar.gz
cpython-984890fcbbb2bb9d7168fd78a1383804593c3fd3.tar.bz2
Close #13415: Test in configure if unsetenv() has a return value or not.
Patch written by Charles-François Natali.
Diffstat (limited to 'Modules')
-rw-r--r--Modules/posixmodule.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
index e42db5b..8ba2975 100644
--- a/Modules/posixmodule.c
+++ b/Modules/posixmodule.c
@@ -7841,19 +7841,24 @@ static PyObject *
posix_unsetenv(PyObject *self, PyObject *args)
{
PyObject *name;
+#ifndef HAVE_BROKEN_UNSETENV
int err;
+#endif
if (!PyArg_ParseTuple(args, "O&:unsetenv",
PyUnicode_FSConverter, &name))
return NULL;
-
+#ifdef HAVE_BROKEN_UNSETENV
+ unsetenv(PyBytes_AS_STRING(name));
+#else
err = unsetenv(PyBytes_AS_STRING(name));
if (err) {
Py_DECREF(name);
return posix_error();
}
+#endif
/* Remove the key from posix_putenv_garbage;
* this will cause it to be collected. This has to