summaryrefslogtreecommitdiffstats
path: root/Objects/exceptions.c
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2012-01-18 15:19:19 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2012-01-18 15:19:19 (GMT)
commitbb5b92d324c06e586dfaef1c980e3de2e94e86ae (patch)
tree54254a6d2fda03cee135834ff597d18b7cf63a28 /Objects/exceptions.c
parentfff47ab342e79d02cf871980987b8b30b2f09c37 (diff)
parentfc1b6f0078a6bda75b571ee7877328c8ca82877d (diff)
downloadcpython-bb5b92d324c06e586dfaef1c980e3de2e94e86ae.zip
cpython-bb5b92d324c06e586dfaef1c980e3de2e94e86ae.tar.gz
cpython-bb5b92d324c06e586dfaef1c980e3de2e94e86ae.tar.bz2
Merge refleak fixes from 3.2
Diffstat (limited to 'Objects/exceptions.c')
-rw-r--r--Objects/exceptions.c44
1 files changed, 23 insertions, 21 deletions
diff --git a/Objects/exceptions.c b/Objects/exceptions.c
index a529a3c..2eb1aab 100644
--- a/Objects/exceptions.c
+++ b/Objects/exceptions.c
@@ -2437,27 +2437,29 @@ _PyExc_Init(void)
preallocate_memerrors();
- PyExc_RecursionErrorInst = BaseException_new(&_PyExc_RuntimeError, NULL, NULL);
- if (!PyExc_RecursionErrorInst)
- Py_FatalError("Cannot pre-allocate RuntimeError 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 RuntimeError "
- "pre-allocation");
- args_tuple = PyTuple_Pack(1, exc_message);
- if (!args_tuple)
- Py_FatalError("cannot allocate tuple for RuntimeError "
- "pre-allocation");
- Py_DECREF(exc_message);
- if (BaseException_init(err_inst, args_tuple, NULL))
- Py_FatalError("init of pre-allocated RuntimeError failed");
- Py_DECREF(args_tuple);
+ if (!PyExc_RecursionErrorInst) {
+ PyExc_RecursionErrorInst = BaseException_new(&_PyExc_RuntimeError, NULL, NULL);
+ if (!PyExc_RecursionErrorInst)
+ Py_FatalError("Cannot pre-allocate RuntimeError 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 RuntimeError "
+ "pre-allocation");
+ args_tuple = PyTuple_Pack(1, exc_message);
+ if (!args_tuple)
+ Py_FatalError("cannot allocate tuple for RuntimeError "
+ "pre-allocation");
+ Py_DECREF(exc_message);
+ if (BaseException_init(err_inst, args_tuple, NULL))
+ Py_FatalError("init of pre-allocated RuntimeError failed");
+ Py_DECREF(args_tuple);
+ }
}
Py_DECREF(bltinmod);