From: Just van Rossum Date: Fri, 4 Jan 2002 14:39:29 +0000 (+0000) Subject: Callback error handling improvements: X-Git-Tag: v2.3c1~6892 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=7d1d396134874bf63306d3cb401432afdb7969e7;p=python Callback error handling improvements: - print traceback - don't use fprintf() - clear exception (implied by PyErr_Print()) --- diff --git a/Mac/Modules/drag/_Dragmodule.c b/Mac/Modules/drag/_Dragmodule.c index 5312023f16..c874003450 100644 --- a/Mac/Modules/drag/_Dragmodule.c +++ b/Mac/Modules/drag/_Dragmodule.c @@ -898,7 +898,8 @@ dragglue_TrackingHandler(DragTrackingMessage theMessage, WindowPtr theWindow, rv = PyEval_CallObject((PyObject *)handlerRefCon, args); Py_DECREF(args); if ( rv == NULL ) { - fprintf(stderr, "Drag: Exception in TrackingHandler\n"); + PySys_WriteStderr("Drag: Exception in TrackingHandler\n"); + PyErr_Print(); return -1; } i = -1; @@ -923,7 +924,8 @@ dragglue_ReceiveHandler(WindowPtr theWindow, void *handlerRefCon, rv = PyEval_CallObject((PyObject *)handlerRefCon, args); Py_DECREF(args); if ( rv == NULL ) { - fprintf(stderr, "Drag: Exception in ReceiveHandler\n"); + PySys_WriteStderr("Drag: Exception in ReceiveHandler\n"); + PyErr_Print(); return -1; } i = -1; @@ -951,7 +953,8 @@ dragglue_SendData(FlavorType theType, void *dragSendRefCon, rv = PyEval_CallObject(self->sendproc, args); Py_DECREF(args); if ( rv == NULL ) { - fprintf(stderr, "Drag: Exception in SendDataHandler\n"); + PySys_WriteStderr("Drag: Exception in SendDataHandler\n"); + PyErr_Print(); return -1; } i = -1; diff --git a/Mac/Modules/drag/dragsupport.py b/Mac/Modules/drag/dragsupport.py index c63699376a..3fcc2ab2ff 100644 --- a/Mac/Modules/drag/dragsupport.py +++ b/Mac/Modules/drag/dragsupport.py @@ -82,7 +82,8 @@ dragglue_TrackingHandler(DragTrackingMessage theMessage, WindowPtr theWindow, rv = PyEval_CallObject((PyObject *)handlerRefCon, args); Py_DECREF(args); if ( rv == NULL ) { - fprintf(stderr, "Drag: Exception in TrackingHandler\\n"); + PySys_WriteStderr("Drag: Exception in TrackingHandler\\n"); + PyErr_Print(); return -1; } i = -1; @@ -107,7 +108,8 @@ dragglue_ReceiveHandler(WindowPtr theWindow, void *handlerRefCon, rv = PyEval_CallObject((PyObject *)handlerRefCon, args); Py_DECREF(args); if ( rv == NULL ) { - fprintf(stderr, "Drag: Exception in ReceiveHandler\\n"); + PySys_WriteStderr("Drag: Exception in ReceiveHandler\\n"); + PyErr_Print(); return -1; } i = -1; @@ -135,7 +137,8 @@ dragglue_SendData(FlavorType theType, void *dragSendRefCon, rv = PyEval_CallObject(self->sendproc, args); Py_DECREF(args); if ( rv == NULL ) { - fprintf(stderr, "Drag: Exception in SendDataHandler\\n"); + PySys_WriteStderr("Drag: Exception in SendDataHandler\\n"); + PyErr_Print(); return -1; } i = -1;