Close #13415: Test in configure if unsetenv() has a return value or not.

Patch written by Charles-François Natali.
This commit is contained in:
Victor Stinner 2011-11-24 13:53:38 +01:00
parent 1518e8713d
commit 984890fcbb
4 changed files with 46 additions and 1 deletions

View file

@ -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