mirror of
https://github.com/python/cpython.git
synced 2025-07-23 11:15:24 +00:00
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:
parent
1518e8713d
commit
984890fcbb
4 changed files with 46 additions and 1 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue