]> granicus.if.org Git - python/commitdiff
Callback error handling improvements:
authorJust van Rossum <just@letterror.com>
Fri, 4 Jan 2002 14:39:29 +0000 (14:39 +0000)
committerJust van Rossum <just@letterror.com>
Fri, 4 Jan 2002 14:39:29 +0000 (14:39 +0000)
- print traceback
- don't use fprintf()
- clear exception (implied by PyErr_Print())

Mac/Modules/drag/_Dragmodule.c
Mac/Modules/drag/dragsupport.py

index 5312023f16c9dd74a8fc3d069f9186a55fe1f840..c87400345097f5632351bc266b6ab6125049dbf7 100644 (file)
@@ -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;
index c63699376a22c3d2fb673c70a74ed89970aee61c..3fcc2ab2ff7e20fc4cd9de37ecf5abc369f9a908 100644 (file)
@@ -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;