klappnase added the comment:

At least with python 3.4 here wantobjects still is valid, and personally I 
really hope that it remains this way, because I use to set wantobjects=False in 
my own code to avoid having to deal with errors because of some method or other 
unexpectedly returning TclObjects instead of Python objects (which has been 
happening here occasionally ever since they were invented).
I am practically illiterate with C, so I cannot tell what this code does, but 
at least I believe I see clearly here that it appears to be still used:

static TkappObject *
Tkapp_New(const char *screenName, const char *className,
          int interactive, int wantobjects, int wantTk, int sync,
          const char *use)
{
    TkappObject *v;
    char *argv0;

    v = PyObject_New(TkappObject, (PyTypeObject *) Tkapp_Type);
    if (v == NULL)
        return NULL;
    Py_INCREF(Tkapp_Type);

    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();
    v->dispatching = 0;
(...)

static PyObject*
Tkapp_CallResult(TkappObject *self)
{
    PyObject *res = NULL;
    Tcl_Obj *value = Tcl_GetObjResult(self->interp);
    if(self->wantobjects) {
        /* 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 {
        res = unicodeFromTclObj(value);
    }
    return res;
}

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue28498>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to