Index: Modules/_tkinter.c =================================================================== --- Modules/_tkinter.c (revision 63812) +++ Modules/_tkinter.c (working copy) @@ -247,7 +247,6 @@ typedef struct { PyObject_HEAD Tcl_Interp *interp; - int wantobjects; int threaded; /* True if tcl_platform[threaded] */ Tcl_ThreadId thread_id; int dispatching; @@ -584,7 +583,7 @@ static TkappObject * Tkapp_New(char *screenName, char *className, - int interactive, int wantobjects, int wantTk, int sync, char *use) + int interactive, int wantTk, int sync, char *use) { TkappObject *v; char *argv0; @@ -594,7 +593,6 @@ return NULL; v->interp = Tcl_CreateInterp(); - v->wantobjects = wantobjects; v->threaded = Tcl_GetVar2Ex(v->interp, "tcl_platform", "threaded", TCL_GLOBAL_ONLY) != NULL; v->thread_id = Tcl_GetCurrentThread(); @@ -792,8 +790,7 @@ PyTclObject_cmp(PyTclObject *self, PyTclObject *other) { int res; - res = strcmp(Tcl_GetString(self->value), - Tcl_GetString(other->value)); + res = strcmp(Tcl_GetString(self->value), Tcl_GetString(other->value)); if (res < 0) return -1; if (res > 0) return 1; return 0; @@ -948,12 +945,15 @@ TkappObject *app = (TkappObject*)tkapp; if (value->typePtr == NULL) { - return PyUnicode_FromStringAndSize(value->bytes, - value->length); + char *s; + int len; + s = Tcl_GetStringFromObj(value, &len); + return PyUnicode_FromStringAndSize(s, len); } if (value->typePtr == app->BooleanType) { - result = value->internalRep.longValue ? Py_True : Py_False; + int b; + result = Tcl_GetBooleanFromObj(NULL, value, &b) ? Py_True: Py_False; Py_INCREF(result); return result; } @@ -965,11 +965,15 @@ } if (value->typePtr == app->DoubleType) { - return PyFloat_FromDouble(value->internalRep.doubleValue); + double d; + Tcl_GetDoubleFromObj(NULL, value, &d); + return PyFloat_FromDouble(d); } if (value->typePtr == app->IntType) { - return PyLong_FromLong(value->internalRep.longValue); + int i; + Tcl_GetIntFromObj(NULL, value, &i); + return PyLong_FromLong(i); } if (value->typePtr == app->ListType) { @@ -1113,20 +1117,14 @@ Tkapp_CallResult(TkappObject *self) { PyObject *res = NULL; - if(self->wantobjects) { - Tcl_Obj *value = Tcl_GetObjResult(self->interp); - /* Not sure whether the IncrRef is necessary, but something - may overwrite the interpreter result while we are - converting it. */ - Tcl_IncrRefCount(value); - res = FromObj((PyObject*)self, value); - Tcl_DecrRefCount(value); - } else { - const char *s = Tcl_GetStringResult(self->interp); - const char *p = s; + Tcl_Obj *value = Tcl_GetObjResult(self->interp); + /* Not sure whether the IncrRef is necessary, but something + * may overwrite the interpreter result while we are + * converting it. */ + Tcl_IncrRefCount(value); + res = FromObj((PyObject*)self, value); + Tcl_DecrRefCount(value); - res = PyUnicode_FromStringAndSize(s, (int)(p-s)); - } return res; } @@ -1566,7 +1564,6 @@ } - static PyObject * GetVar(PyObject *self, PyObject *args, int flags) { @@ -1584,12 +1581,7 @@ if (tres == NULL) { PyErr_SetString(Tkinter_TclError, Tcl_GetStringResult(Tkapp_Interp(self))); } else { - if (((TkappObject*)self)->wantobjects) { - res = FromObj(self, tres); - } - else { - res = PyUnicode_FromString(Tcl_GetString(tres)); - } + res = FromObj(self, tres); } LEAVE_OVERLAP_TCL return res; @@ -2587,21 +2579,6 @@ } static PyObject * -Tkapp_WantObjects(PyObject *self, PyObject *args) -{ - - int wantobjects = -1; - if (!PyArg_ParseTuple(args, "|i:wantobjects", &wantobjects)) - return NULL; - if (wantobjects == -1) - return PyBool_FromLong(((TkappObject*)self)->wantobjects); - ((TkappObject*)self)->wantobjects = wantobjects; - - Py_INCREF(Py_None); - return Py_None; -} - -static PyObject * Tkapp_WillDispatch(PyObject *self, PyObject *args) { @@ -2617,7 +2594,6 @@ static PyMethodDef Tkapp_methods[] = { {"willdispatch", Tkapp_WillDispatch, METH_NOARGS}, - {"wantobjects", Tkapp_WantObjects, METH_VARARGS}, {"call", Tkapp_Call, METH_VARARGS}, {"globalcall", Tkapp_GlobalCall, METH_VARARGS}, {"eval", Tkapp_Eval, METH_VARARGS}, @@ -2816,22 +2792,19 @@ try getting rid of it. */ char *className = NULL; int interactive = 0; - int wantobjects = 0; int wantTk = 1; /* If false, then Tk_Init() doesn't get called */ int sync = 0; /* pass -sync to wish */ char *use = NULL; /* pass -use to wish */ className = "Tk"; - if (!PyArg_ParseTuple(args, "|zssiiiiz:create", + if (!PyArg_ParseTuple(args, "|zssiiiz:create", &screenName, &baseName, &className, - &interactive, &wantobjects, &wantTk, - &sync, &use)) + &interactive, &wantTk, &sync, &use)) return NULL; return (PyObject *) Tkapp_New(screenName, className, - interactive, wantobjects, wantTk, - sync, use); + interactive, wantTk, sync, use); } static PyObject * Index: Lib/tkinter/__init__.py =================================================================== --- Lib/tkinter/__init__.py (revision 63812) +++ Lib/tkinter/__init__.py (working copy) @@ -44,8 +44,6 @@ except ImportError: _MacOS = None -wantobjects = 1 - TkVersion = float(_tkinter.TK_VERSION) TclVersion = float(_tkinter.TCL_VERSION) @@ -1634,7 +1632,8 @@ if ext not in ('.py', '.pyc', '.pyo'): baseName = baseName + ext interactive = 0 - self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use) + self.tk = _tkinter.create(screenName, baseName, className, interactive, + useTk, sync, use) if useTk: self._loadtk() self.readprofile(baseName, className) Index: Lib/tkinter/filedialog.py =================================================================== --- Lib/tkinter/filedialog.py (revision 63812) +++ Lib/tkinter/filedialog.py (working copy) @@ -338,9 +338,6 @@ self.options["initialdir"] = path # don't set initialfile or filename, as we have multiple of these return result - if not widget.tk.wantobjects() and "multiple" in self.options: - # Need to split result explicitly - return self._fixresult(widget, widget.tk.splitlist(result)) return _Dialog._fixresult(self, widget, result) class SaveAs(_Dialog):