]> granicus.if.org Git - python/commitdiff
Add a new method of interpreter objects, interpaddr(). This returns
authorGuido van Rossum <guido@python.org>
Wed, 29 Apr 1998 16:17:01 +0000 (16:17 +0000)
committerGuido van Rossum <guido@python.org>
Wed, 29 Apr 1998 16:17:01 +0000 (16:17 +0000)
the address of the Tcl interpreter object, as an integer.  Not very
useful for the Python programmer, but this can be called by another C
extension that needs to make calls into the Tcl/Tk C API and needs to
get the address of the Tcl interpreter object.  A simple cast of the
return value to (Tcl_Interp *) will do the trick now.

Modules/_tkinter.c

index b8c59a8f7524a972193034de9ce23e80975bc955..6226f6b46b6ee848a76615c5f0d2fd4e2bf73d28 100644 (file)
@@ -1346,6 +1346,18 @@ Tkapp_Quit(self, args)
        return Py_None;
 }
 
+static PyObject *
+Tkapp_InterpAddr(self, args)
+       PyObject *self;
+       PyObject *args;
+{
+
+       if (!PyArg_ParseTuple(args, ""))
+               return NULL;
+
+       return PyInt_FromLong((long)Tkapp_Interp(self));
+}
+
 
 \f
 /**** Tkapp Method List ****/
@@ -1385,6 +1397,7 @@ static PyMethodDef Tkapp_methods[] =
        {"mainloop",           Tkapp_MainLoop, 1},
        {"dooneevent",         Tkapp_DoOneEvent, 1},
        {"quit",               Tkapp_Quit, 1},
+       {"interpaddr",         Tkapp_InterpAddr, 1},
        {NULL,                 NULL}
 };