summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorxdegaye <xdegaye@gmail.com>2017-10-26 13:09:06 (GMT)
committerGitHub <noreply@github.com>2017-10-26 13:09:06 (GMT)
commit56d1f5ca32892c7643eb8cee49c40c1644f1abfe (patch)
tree696b62e9bdd22063a894ecb5a7b9eafe60385edf /Objects
parent275d2d9c4663a1ea8d1f7c8778567a735b0372c1 (diff)
downloadcpython-56d1f5ca32892c7643eb8cee49c40c1644f1abfe.zip
cpython-56d1f5ca32892c7643eb8cee49c40c1644f1abfe.tar.gz
cpython-56d1f5ca32892c7643eb8cee49c40c1644f1abfe.tar.bz2
bpo-30697: Fix PyErr_NormalizeException() when no memory (GH-2327)
Diffstat (limited to 'Objects')
-rw-r--r--Objects/exceptions.c32
1 files changed, 0 insertions, 32 deletions
diff --git a/Objects/exceptions.c b/Objects/exceptions.c
index 42b3fc7..637d766 100644
--- a/Objects/exceptions.c
+++ b/Objects/exceptions.c
@@ -2409,12 +2409,6 @@ SimpleExtendsException(PyExc_Warning, ResourceWarning,
-/* Pre-computed RecursionError instance for when recursion depth is reached.
- Meant to be used when normalizing the exception for exceeding the recursion
- depth will cause its own infinite recursion.
-*/
-PyObject *PyExc_RecursionErrorInst = NULL;
-
#define PRE_INIT(TYPE) \
if (!(_PyExc_ ## TYPE.tp_flags & Py_TPFLAGS_READY)) { \
if (PyType_Ready(&_PyExc_ ## TYPE) < 0) \
@@ -2674,37 +2668,11 @@ _PyExc_Init(PyObject *bltinmod)
ADD_ERRNO(TimeoutError, ETIMEDOUT)
preallocate_memerrors();
-
- if (!PyExc_RecursionErrorInst) {
- PyExc_RecursionErrorInst = BaseException_new(&_PyExc_RecursionError, NULL, NULL);
- if (!PyExc_RecursionErrorInst)
- Py_FatalError("Cannot pre-allocate RecursionError instance for "
- "recursion errors");
- else {
- PyBaseExceptionObject *err_inst =
- (PyBaseExceptionObject *)PyExc_RecursionErrorInst;
- PyObject *args_tuple;
- PyObject *exc_message;
- exc_message = PyUnicode_FromString("maximum recursion depth exceeded");
- if (!exc_message)
- Py_FatalError("cannot allocate argument for RecursionError "
- "pre-allocation");
- args_tuple = PyTuple_Pack(1, exc_message);
- if (!args_tuple)
- Py_FatalError("cannot allocate tuple for RecursionError "
- "pre-allocation");
- Py_DECREF(exc_message);
- if (BaseException_init(err_inst, args_tuple, NULL))
- Py_FatalError("init of pre-allocated RecursionError failed");
- Py_DECREF(args_tuple);
- }
- }
}
void
_PyExc_Fini(void)
{
- Py_CLEAR(PyExc_RecursionErrorInst);
free_preallocated_memerrors();
Py_CLEAR(errnomap);
}