mirror of
https://github.com/python/cpython.git
synced 2025-10-14 18:59:46 +00:00
Whitespace cleanup.
This commit is contained in:
parent
ce272b6f8a
commit
7ce29ca41c
1 changed files with 39 additions and 38 deletions
|
@ -1467,8 +1467,8 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
|
||||||
case RAISE_VARARGS:
|
case RAISE_VARARGS:
|
||||||
v = w = NULL;
|
v = w = NULL;
|
||||||
switch (oparg) {
|
switch (oparg) {
|
||||||
case 2:
|
case 2:
|
||||||
v = POP(); /* cause */
|
v = POP(); /* cause */
|
||||||
case 1:
|
case 1:
|
||||||
w = POP(); /* exc */
|
w = POP(); /* exc */
|
||||||
case 0: /* Fallthrough */
|
case 0: /* Fallthrough */
|
||||||
|
@ -2876,7 +2876,7 @@ set_exc_info(PyThreadState *tstate,
|
||||||
tstate->exc_type = type;
|
tstate->exc_type = type;
|
||||||
tstate->exc_value = value;
|
tstate->exc_value = value;
|
||||||
tstate->exc_traceback = tb;
|
tstate->exc_traceback = tb;
|
||||||
PyException_SetTraceback(value, tb);
|
PyException_SetTraceback(value, tb);
|
||||||
Py_XDECREF(tmp_type);
|
Py_XDECREF(tmp_type);
|
||||||
Py_XDECREF(tmp_value);
|
Py_XDECREF(tmp_value);
|
||||||
Py_XDECREF(tmp_tb);
|
Py_XDECREF(tmp_tb);
|
||||||
|
@ -2927,7 +2927,7 @@ reset_exc_info(PyThreadState *tstate)
|
||||||
static enum why_code
|
static enum why_code
|
||||||
do_raise(PyObject *exc, PyObject *cause)
|
do_raise(PyObject *exc, PyObject *cause)
|
||||||
{
|
{
|
||||||
PyObject *type = NULL, *value = NULL, *tb = NULL;
|
PyObject *type = NULL, *value = NULL, *tb = NULL;
|
||||||
|
|
||||||
if (exc == NULL) {
|
if (exc == NULL) {
|
||||||
/* Reraise */
|
/* Reraise */
|
||||||
|
@ -2935,16 +2935,16 @@ do_raise(PyObject *exc, PyObject *cause)
|
||||||
type = tstate->exc_type;
|
type = tstate->exc_type;
|
||||||
value = tstate->exc_value;
|
value = tstate->exc_value;
|
||||||
tb = tstate->exc_traceback;
|
tb = tstate->exc_traceback;
|
||||||
if (type == Py_None) {
|
if (type == Py_None) {
|
||||||
PyErr_SetString(PyExc_RuntimeError,
|
PyErr_SetString(PyExc_RuntimeError,
|
||||||
"No active exception to reraise");
|
"No active exception to reraise");
|
||||||
return WHY_EXCEPTION;
|
return WHY_EXCEPTION;
|
||||||
}
|
}
|
||||||
Py_XINCREF(type);
|
Py_XINCREF(type);
|
||||||
Py_XINCREF(value);
|
Py_XINCREF(value);
|
||||||
Py_XINCREF(tb);
|
Py_XINCREF(tb);
|
||||||
PyErr_Restore(type, value, tb);
|
PyErr_Restore(type, value, tb);
|
||||||
return WHY_RERAISE;
|
return WHY_RERAISE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* We support the following forms of raise:
|
/* We support the following forms of raise:
|
||||||
|
@ -2953,11 +2953,11 @@ do_raise(PyObject *exc, PyObject *cause)
|
||||||
raise <type> */
|
raise <type> */
|
||||||
|
|
||||||
if (PyExceptionClass_Check(exc)) {
|
if (PyExceptionClass_Check(exc)) {
|
||||||
type = exc;
|
type = exc;
|
||||||
value = PyObject_CallObject(exc, NULL);
|
value = PyObject_CallObject(exc, NULL);
|
||||||
if (value == NULL)
|
if (value == NULL)
|
||||||
goto raise_error;
|
goto raise_error;
|
||||||
}
|
}
|
||||||
else if (PyExceptionInstance_Check(exc)) {
|
else if (PyExceptionInstance_Check(exc)) {
|
||||||
value = exc;
|
value = exc;
|
||||||
type = PyExceptionInstance_Class(exc);
|
type = PyExceptionInstance_Class(exc);
|
||||||
|
@ -2966,31 +2966,32 @@ do_raise(PyObject *exc, PyObject *cause)
|
||||||
else {
|
else {
|
||||||
/* Not something you can raise. You get an exception
|
/* Not something you can raise. You get an exception
|
||||||
anyway, just not what you specified :-) */
|
anyway, just not what you specified :-) */
|
||||||
Py_DECREF(exc);
|
Py_DECREF(exc);
|
||||||
PyErr_SetString(PyExc_TypeError,
|
PyErr_SetString(PyExc_TypeError,
|
||||||
"exceptions must derive from BaseException");
|
"exceptions must derive from BaseException");
|
||||||
goto raise_error;
|
goto raise_error;
|
||||||
}
|
}
|
||||||
|
|
||||||
tb = PyException_GetTraceback(value);
|
tb = PyException_GetTraceback(value);
|
||||||
if (cause) {
|
if (cause) {
|
||||||
PyObject *fixed_cause;
|
PyObject *fixed_cause;
|
||||||
if (PyExceptionClass_Check(cause)) {
|
if (PyExceptionClass_Check(cause)) {
|
||||||
fixed_cause = PyObject_CallObject(cause, NULL);
|
fixed_cause = PyObject_CallObject(cause, NULL);
|
||||||
if (fixed_cause == NULL)
|
if (fixed_cause == NULL)
|
||||||
goto raise_error;
|
goto raise_error;
|
||||||
Py_DECREF(cause);
|
Py_DECREF(cause);
|
||||||
}
|
}
|
||||||
else if (PyExceptionInstance_Check(cause)) {
|
else if (PyExceptionInstance_Check(cause)) {
|
||||||
fixed_cause = cause;
|
fixed_cause = cause;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
PyErr_SetString(PyExc_TypeError,
|
PyErr_SetString(PyExc_TypeError,
|
||||||
"exception causes must derive from BaseException");
|
"exception causes must derive from "
|
||||||
goto raise_error;
|
"BaseException");
|
||||||
}
|
goto raise_error;
|
||||||
PyException_SetCause(value, fixed_cause);
|
}
|
||||||
}
|
PyException_SetCause(value, fixed_cause);
|
||||||
|
}
|
||||||
|
|
||||||
PyErr_Restore(type, value, tb);
|
PyErr_Restore(type, value, tb);
|
||||||
return WHY_EXCEPTION;
|
return WHY_EXCEPTION;
|
||||||
|
@ -3675,7 +3676,7 @@ do_call(PyObject *func, PyObject ***pp_stack, int na, int nk)
|
||||||
PCALL(PCALL_OTHER);
|
PCALL(PCALL_OTHER);
|
||||||
#endif
|
#endif
|
||||||
result = PyObject_Call(func, callargs, kwdict);
|
result = PyObject_Call(func, callargs, kwdict);
|
||||||
call_fail:
|
call_fail:
|
||||||
Py_XDECREF(callargs);
|
Py_XDECREF(callargs);
|
||||||
Py_XDECREF(kwdict);
|
Py_XDECREF(kwdict);
|
||||||
return result;
|
return result;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue