Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 84890df

Browse files
authored
Merge pull request #7634 from QuLogic/tkagg-pointers
FIX: Use correct type for Tk addresses.
2 parents f99ae8b + a91559b commit 84890df

File tree

1 file changed

+5
-14
lines changed

1 file changed

+5
-14
lines changed

src/_tkagg.cpp

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -183,32 +183,23 @@ static int PyAggImagePhoto(ClientData clientdata, Tcl_Interp *interp, int
183183
return TCL_OK;
184184
}
185185

186-
static PyObject *_pyobj_addr(PyObject *self, PyObject *args)
187-
{
188-
PyObject *pyobj;
189-
if (!PyArg_ParseTuple(args, "O", &pyobj)) {
190-
return NULL;
191-
}
192-
return Py_BuildValue("n", (Py_ssize_t)pyobj);
193-
}
194-
195186
static PyObject *_tkinit(PyObject *self, PyObject *args)
196187
{
197188
Tcl_Interp *interp;
198189
TkappObject *app;
199190

200-
Py_ssize_t arg;
191+
PyObject *arg;
201192
int is_interp;
202-
if (!PyArg_ParseTuple(args, "ni", &arg, &is_interp)) {
193+
if (!PyArg_ParseTuple(args, "Oi", &arg, &is_interp)) {
203194
return NULL;
204195
}
205196

206197
if (is_interp) {
207-
interp = (Tcl_Interp *)arg;
198+
interp = (Tcl_Interp *)PyLong_AsVoidPtr(arg);
208199
} else {
209200
/* Do it the hard way. This will break if the TkappObject
210201
layout changes */
211-
app = (TkappObject *)arg;
202+
app = (TkappObject *)PyLong_AsVoidPtr(arg);
212203
interp = app->interp;
213204
}
214205

@@ -226,7 +217,7 @@ static PyObject *_tkinit(PyObject *self, PyObject *args)
226217

227218
static PyMethodDef functions[] = {
228219
/* Tkinter interface stuff */
229-
{ "_pyobj_addr", (PyCFunction)_pyobj_addr, 1 }, { "tkinit", (PyCFunction)_tkinit, 1 },
220+
{ "tkinit", (PyCFunction)_tkinit, 1 },
230221
{ NULL, NULL } /* sentinel */
231222
};
232223

0 commit comments

Comments
 (0)