summaryrefslogtreecommitdiffstats
path: root/Modules/posixmodule.c
diff options
context:
space:
mode:
Diffstat (limited to 'Modules/posixmodule.c')
-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