diff options
author | Martin v. Löwis <martin@v.loewis.de> | 2008-01-01 21:05:17 (GMT) |
---|---|---|
committer | Martin v. Löwis <martin@v.loewis.de> | 2008-01-01 21:05:17 (GMT) |
commit | 17cb5cf403c1a6da312588f6c8d076a249d59d08 (patch) | |
tree | f77b50354a627b9610b180e96e4e83dd0d0cf155 | |
parent | 9a1d8cec111707699375668eb2068e5ce3759b21 (diff) | |
download | cpython-17cb5cf403c1a6da312588f6c8d076a249d59d08.zip cpython-17cb5cf403c1a6da312588f6c8d076a249d59d08.tar.gz cpython-17cb5cf403c1a6da312588f6c8d076a249d59d08.tar.bz2 |
Return results from Python callbacks to Tcl as Tcl objects.
Fixes Tk issue #1851526
-rw-r--r-- | Modules/_tkinter.c | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/Modules/_tkinter.c b/Modules/_tkinter.c index 8f5be85..3cef4e7 100644 --- a/Modules/_tkinter.c +++ b/Modules/_tkinter.c @@ -1992,9 +1992,9 @@ static int PythonCmd(ClientData clientData, Tcl_Interp *interp, int argc, char *argv[]) { PythonCmd_ClientData *data = (PythonCmd_ClientData *)clientData; - PyObject *self, *func, *arg, *res, *tmp; + PyObject *self, *func, *arg, *res; int i, rv; - char *s; + Tcl_Obj *obj_res; ENTER_PYTHON @@ -2021,24 +2021,17 @@ PythonCmd(ClientData clientData, Tcl_Interp *interp, int argc, char *argv[]) if (res == NULL) return PythonCmd_Error(interp); - if (!(tmp = PyList_New(0))) { - Py_DECREF(res); - return PythonCmd_Error(interp); - } - - s = AsString(res, tmp); - if (s == NULL) { + obj_res = AsObj(res); + if (obj_res == NULL) { Py_DECREF(res); - Py_DECREF(tmp); return PythonCmd_Error(interp); } else { - Tcl_SetResult(Tkapp_Interp(self), s, TCL_VOLATILE); + Tcl_SetObjResult(Tkapp_Interp(self), obj_res); rv = TCL_OK; } Py_DECREF(res); - Py_DECREF(tmp); LEAVE_PYTHON |