summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJack Jansen <jack.jansen@cwi.nl>2002-02-27 23:12:31 (GMT)
committerJack Jansen <jack.jansen@cwi.nl>2002-02-27 23:12:31 (GMT)
commit14ffb30216be7cf8d8442f1b7a65bf420b6da40f (patch)
treee3486f6c0f9d4f2eb5bbee84c236f2aed89ddf23
parent348fff88449ab98ca64572d9c05ee8a4a522d53e (diff)
downloadcpython-14ffb30216be7cf8d8442f1b7a65bf420b6da40f.zip
cpython-14ffb30216be7cf8d8442f1b7a65bf420b6da40f.tar.gz
cpython-14ffb30216be7cf8d8442f1b7a65bf420b6da40f.tar.bz2
Backport of 1.7 (of _Dragmodule.c):
Callback error handling improvements: - print traceback - don't use fprintf() - clear exception (implied by PyErr_Print())
-rw-r--r--Mac/Modules/drag/_Dragmodule.c9
-rw-r--r--Mac/Modules/drag/dragsupport.py9
2 files changed, 12 insertions, 6 deletions
diff --git a/Mac/Modules/drag/_Dragmodule.c b/Mac/Modules/drag/_Dragmodule.c
index 5312023..c874003 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 c636993..3fcc2ab 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;