Skip to content

Commit 9d1b7ae

Browse files
committed
Add a new method of interpreter objects, interpaddr(). This returns
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.
1 parent 06245ac commit 9d1b7ae

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

Modules/_tkinter.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1346,6 +1346,18 @@ Tkapp_Quit(self, args)
13461346
return Py_None;
13471347
}
13481348

1349+
static PyObject *
1350+
Tkapp_InterpAddr(self, args)
1351+
PyObject *self;
1352+
PyObject *args;
1353+
{
1354+
1355+
if (!PyArg_ParseTuple(args, ""))
1356+
return NULL;
1357+
1358+
return PyInt_FromLong((long)Tkapp_Interp(self));
1359+
}
1360+
13491361

13501362

13511363
/**** Tkapp Method List ****/
@@ -1385,6 +1397,7 @@ static PyMethodDef Tkapp_methods[] =
13851397
{"mainloop", Tkapp_MainLoop, 1},
13861398
{"dooneevent", Tkapp_DoOneEvent, 1},
13871399
{"quit", Tkapp_Quit, 1},
1400+
{"interpaddr", Tkapp_InterpAddr, 1},
13881401
{NULL, NULL}
13891402
};
13901403

0 commit comments

Comments
 (0)