diff options
Diffstat (limited to 'Python/errors.c')
-rw-r--r-- | Python/errors.c | 68 |
1 files changed, 17 insertions, 51 deletions
diff --git a/Python/errors.c b/Python/errors.c index 2b6a863..24eeead 100644 --- a/Python/errors.c +++ b/Python/errors.c @@ -30,10 +30,7 @@ extern char *strerror(int); #endif void -PyErr_Restore(type, value, traceback) - PyObject *type; - PyObject *value; - PyObject *traceback; +PyErr_Restore(PyObject *type, PyObject *value, PyObject *traceback) { PyThreadState *tstate = PyThreadState_GET(); PyObject *oldtype, *oldvalue, *oldtraceback; @@ -60,9 +57,7 @@ PyErr_Restore(type, value, traceback) } void -PyErr_SetObject(exception, value) - PyObject *exception; - PyObject *value; +PyErr_SetObject(PyObject *exception, PyObject *value) { Py_XINCREF(exception); Py_XINCREF(value); @@ -70,16 +65,13 @@ PyErr_SetObject(exception, value) } void -PyErr_SetNone(exception) - PyObject *exception; +PyErr_SetNone(PyObject *exception) { PyErr_SetObject(exception, (PyObject *)NULL); } void -PyErr_SetString(exception, string) - PyObject *exception; - const char *string; +PyErr_SetString(PyObject *exception, const char *string) { PyObject *value = PyString_FromString(string); PyErr_SetObject(exception, value); @@ -88,7 +80,7 @@ PyErr_SetString(exception, string) PyObject * -PyErr_Occurred() +PyErr_Occurred(void) { PyThreadState *tstate = PyThreadState_Get(); @@ -97,8 +89,7 @@ PyErr_Occurred() int -PyErr_GivenExceptionMatches(err, exc) - PyObject *err, *exc; +PyErr_GivenExceptionMatches(PyObject *err, PyObject *exc) { if (err == NULL || exc == NULL) { /* maybe caused by "import exceptions" that failed early on */ @@ -129,8 +120,7 @@ PyErr_GivenExceptionMatches(err, exc) int -PyErr_ExceptionMatches(exc) - PyObject *exc; +PyErr_ExceptionMatches(PyObject *exc) { return PyErr_GivenExceptionMatches(PyErr_Occurred(), exc); } @@ -140,10 +130,7 @@ PyErr_ExceptionMatches(exc) eval_code2(), do_raise(), and PyErr_Print() */ void -PyErr_NormalizeException(exc, val, tb) - PyObject **exc; - PyObject **val; - PyObject **tb; +PyErr_NormalizeException(PyObject **exc, PyObject **val, PyObject **tb) { PyObject *type = *exc; PyObject *value = *val; @@ -213,10 +200,7 @@ finally: void -PyErr_Fetch(p_type, p_value, p_traceback) - PyObject **p_type; - PyObject **p_value; - PyObject **p_traceback; +PyErr_Fetch(PyObject **p_type, PyObject **p_value, PyObject **p_traceback) { PyThreadState *tstate = PyThreadState_Get(); @@ -230,7 +214,7 @@ PyErr_Fetch(p_type, p_value, p_traceback) } void -PyErr_Clear() +PyErr_Clear(void) { PyErr_Restore(NULL, NULL, NULL); } @@ -238,7 +222,7 @@ PyErr_Clear() /* Convenience functions to set a type error exception and return 0 */ int -PyErr_BadArgument() +PyErr_BadArgument(void) { PyErr_SetString(PyExc_TypeError, "illegal argument type for built-in operation"); @@ -246,7 +230,7 @@ PyErr_BadArgument() } PyObject * -PyErr_NoMemory() +PyErr_NoMemory(void) { /* raise the pre-allocated instance if it still exists */ if (PyExc_MemoryErrorInst) @@ -261,9 +245,7 @@ PyErr_NoMemory() } PyObject * -PyErr_SetFromErrnoWithFilename(exc, filename) - PyObject *exc; - char *filename; +PyErr_SetFromErrnoWithFilename(PyObject *exc, char *filename) { PyObject *v; char *s; @@ -326,8 +308,7 @@ PyErr_SetFromErrnoWithFilename(exc, filename) PyObject * -PyErr_SetFromErrno(exc) - PyObject *exc; +PyErr_SetFromErrno(PyObject *exc) { return PyErr_SetFromErrnoWithFilename(exc, NULL); } @@ -335,7 +316,7 @@ PyErr_SetFromErrno(exc) #ifdef MS_WINDOWS /* Windows specific error code handling */ PyObject *PyErr_SetFromWindowsErrWithFilename( - int ierr, + int ierr, const char *filename) { int len; @@ -378,32 +359,20 @@ PyObject *PyErr_SetFromWindowsErr(int ierr) #endif /* MS_WINDOWS */ void -PyErr_BadInternalCall() +PyErr_BadInternalCall(void) { PyErr_SetString(PyExc_SystemError, "bad argument to internal function"); } -#ifdef HAVE_STDARG_PROTOTYPES PyObject * PyErr_Format(PyObject *exception, const char *format, ...) -#else -PyObject * -PyErr_Format(exception, format, va_alist) - PyObject *exception; - const char *format; - va_dcl -#endif { va_list vargs; char buffer[500]; /* Caller is responsible for limiting the format */ -#ifdef HAVE_STDARG_PROTOTYPES va_start(vargs, format); -#else - va_start(vargs); -#endif vsprintf(buffer, format, vargs); PyErr_SetString(exception, buffer); @@ -412,10 +381,7 @@ PyErr_Format(exception, format, va_alist) PyObject * -PyErr_NewException(name, base, dict) - char *name; /* modulename.classname */ - PyObject *base; - PyObject *dict; +PyErr_NewException(char *name, PyObject *base, PyObject *dict) { char *dot; PyObject *modulename = NULL; |