mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
Got rid of the file-global PosixError. This was redundant since it
was just an alias for PyExc_OSError and the way we were doing it was causing a (small) memory leak anyway. Just use PyExc_OSError everywhere.
This commit is contained in:
parent
95474f9696
commit
ca74da4e2c
1 changed files with 4 additions and 8 deletions
|
@ -326,20 +326,18 @@ convertenviron()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static PyObject *PosixError; /* Exception posix.error */
|
|
||||||
|
|
||||||
/* Set a POSIX-specific error from errno, and return NULL */
|
/* Set a POSIX-specific error from errno, and return NULL */
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
posix_error()
|
posix_error()
|
||||||
{
|
{
|
||||||
return PyErr_SetFromErrno(PosixError);
|
return PyErr_SetFromErrno(PyExc_OSError);
|
||||||
}
|
}
|
||||||
static PyObject *
|
static PyObject *
|
||||||
posix_error_with_filename(name)
|
posix_error_with_filename(name)
|
||||||
char* name;
|
char* name;
|
||||||
{
|
{
|
||||||
return PyErr_SetFromErrnoWithFilename(PosixError, name);
|
return PyErr_SetFromErrnoWithFilename(PyExc_OSError, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -410,7 +408,7 @@ static PyObject * os2_error(int code)
|
||||||
|
|
||||||
v = Py_BuildValue("(is)", code, text);
|
v = Py_BuildValue("(is)", code, text);
|
||||||
if (v != NULL) {
|
if (v != NULL) {
|
||||||
PyErr_SetObject(PosixError, v);
|
PyErr_SetObject(PyExc_OSError, v);
|
||||||
Py_DECREF(v);
|
Py_DECREF(v);
|
||||||
}
|
}
|
||||||
return NULL; /* Signal to Python that an Exception is Pending */
|
return NULL; /* Signal to Python that an Exception is Pending */
|
||||||
|
@ -3482,7 +3480,5 @@ INITFUNC()
|
||||||
if (all_ins(d))
|
if (all_ins(d))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Py_INCREF(PyExc_OSError);
|
PyDict_SetItemString(d, "error", PyExc_OSError);
|
||||||
PosixError = PyExc_OSError;
|
|
||||||
PyDict_SetItemString(d, "error", PosixError);
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue