diff options
Diffstat (limited to 'Modules/_tkinter.c')
-rw-r--r-- | Modules/_tkinter.c | 42 |
1 files changed, 9 insertions, 33 deletions
diff --git a/Modules/_tkinter.c b/Modules/_tkinter.c index 76af803..1605606 100644 --- a/Modules/_tkinter.c +++ b/Modules/_tkinter.c @@ -3197,7 +3197,7 @@ static struct PyModuleDef _tkintermodule = { PyMODINIT_FUNC PyInit__tkinter(void) { - PyObject *m, *uexe, *cexe, *o; + PyObject *m, *uexe, *cexe; tcl_lock = PyThread_allocate_lock(); if (tcl_lock == NULL) @@ -3207,17 +3207,11 @@ PyInit__tkinter(void) if (m == NULL) return NULL; - o = PyErr_NewException("_tkinter.TclError", NULL, NULL); - if (o == NULL) { + Tkinter_TclError = PyErr_NewException("_tkinter.TclError", NULL, NULL); + if (PyModule_AddObjectRef(m, "TclError", Tkinter_TclError)) { Py_DECREF(m); return NULL; } - if (PyModule_AddObject(m, "TclError", Py_NewRef(o))) { - Py_DECREF(o); - Py_DECREF(m); - return NULL; - } - Tkinter_TclError = o; if (PyModule_AddIntConstant(m, "READABLE", TCL_READABLE)) { Py_DECREF(m); @@ -3264,41 +3258,23 @@ PyInit__tkinter(void) return NULL; } - o = PyType_FromSpec(&Tkapp_Type_spec); - if (o == NULL) { - Py_DECREF(m); - return NULL; - } - if (PyModule_AddObject(m, "TkappType", o)) { - Py_DECREF(o); + Tkapp_Type = PyType_FromSpec(&Tkapp_Type_spec); + if (PyModule_AddObjectRef(m, "TkappType", Tkapp_Type)) { Py_DECREF(m); return NULL; } - Tkapp_Type = o; - o = PyType_FromSpec(&Tktt_Type_spec); - if (o == NULL) { + Tktt_Type = PyType_FromSpec(&Tktt_Type_spec); + if (PyModule_AddObjectRef(m, "TkttType", Tktt_Type)) { Py_DECREF(m); return NULL; } - if (PyModule_AddObject(m, "TkttType", o)) { - Py_DECREF(o); - Py_DECREF(m); - return NULL; - } - Tktt_Type = o; - o = PyType_FromSpec(&PyTclObject_Type_spec); - if (o == NULL) { - Py_DECREF(m); - return NULL; - } - if (PyModule_AddObject(m, "Tcl_Obj", o)) { - Py_DECREF(o); + PyTclObject_Type = PyType_FromSpec(&PyTclObject_Type_spec); + if (PyModule_AddObjectRef(m, "Tcl_Obj", PyTclObject_Type)) { Py_DECREF(m); return NULL; } - PyTclObject_Type = o; /* This helps the dynamic loader; in Unicode aware Tcl versions |