Skip to content

Commit a0cd878

Browse files
authored
Check PyLong_AsVoidPtr result (#9548)
2 parents 4e0aeba + 117de2b commit a0cd878

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

src/_imagingtk.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,10 @@ _tkinit(PyObject *self, PyObject *args) {
3333
}
3434

3535
interp = (Tcl_Interp *)PyLong_AsVoidPtr(arg);
36+
if (interp == NULL && PyErr_Occurred()) {
37+
return NULL;
38+
}
3639

37-
/* This will bomb if interp is invalid... */
3840
TkImaging_Init(interp);
3941

4042
Py_RETURN_NONE;

0 commit comments

Comments
 (0)