| 713 | // callbacks! |
| 714 | static PyObject *pCallbackCaller = NULL; |
| 715 | PyObject *Python_do_callback(PyObject *themeth, PyObject *thearglst) |
| 716 | { |
| 717 | PyObject *result; |
| 718 | if (pCallbackCaller) { |
| 719 | PyObject *newarglst = Py_BuildValue("(OO)",themeth,thearglst); |
| 720 | result = gui_call_object( pCallbackCaller, newarglst ); |
| 721 | DODECREF(newarglst); |
| 722 | } else { |
| 723 | // Only ref to 'themeth' may be map - and if the message hook |
| 724 | // updates the map (ie, removes the function), things get |
| 725 | // a little pear-shaped - as witnessed in bug 1489690. |
| 726 | Py_XINCREF(themeth); |
| 727 | result = gui_call_object( themeth, thearglst ); |
| 728 | Py_XDECREF(themeth); |
| 729 | } |
| 730 | DODECREF(thearglst); |
| 731 | if (result==NULL) { |
| 732 | TRACE("Python_do_callback: callback failed with exception\n"); |
| 733 | gui_print_error(); |
| 734 | } |
| 735 | return result; |
| 736 | } |
| 737 | |
| 738 | // Copied from PyRecord.cpp, should move into pywintypes.h |
| 739 | #if (PY_VERSION_HEX < 0x03000000) |
no test coverage detected