diff options
author | Andrew Svetlov <andrew.svetlov@gmail.com> | 2012-10-07 09:30:51 (GMT) |
---|---|---|
committer | Andrew Svetlov <andrew.svetlov@gmail.com> | 2012-10-07 09:30:51 (GMT) |
commit | 885dc287d30f23c17f06f8e56506b0aa8886b419 (patch) | |
tree | 8e3b90d07be11c35ee56d4662293934454e6dab2 /Modules | |
parent | e12dc28c3815b241b071b5ae4e7de7b9a5ee53a2 (diff) | |
download | cpython-885dc287d30f23c17f06f8e56506b0aa8886b419.zip cpython-885dc287d30f23c17f06f8e56506b0aa8886b419.tar.gz cpython-885dc287d30f23c17f06f8e56506b0aa8886b419.tar.bz2 |
Utilize PyModule_Add{IntConstant,StringConstant,Object} in _tkinter.
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/_tkinter.c | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/Modules/_tkinter.c b/Modules/_tkinter.c index cad87b6..f4c7ad6 100644 --- a/Modules/_tkinter.c +++ b/Modules/_tkinter.c @@ -2895,7 +2895,7 @@ static struct PyModuleDef _tkintermodule = { PyMODINIT_FUNC PyInit__tkinter(void) { - PyObject *m, *d, *uexe, *cexe; + PyObject *m, *uexe, *cexe; if (PyType_Ready(&Tkapp_Type) < 0) return NULL; @@ -2908,32 +2908,32 @@ PyInit__tkinter(void) if (m == NULL) return NULL; - d = PyModule_GetDict(m); Tkinter_TclError = PyErr_NewException("_tkinter.TclError", NULL, NULL); - PyDict_SetItemString(d, "TclError", Tkinter_TclError); - - ins_long(d, "READABLE", TCL_READABLE); - ins_long(d, "WRITABLE", TCL_WRITABLE); - ins_long(d, "EXCEPTION", TCL_EXCEPTION); - ins_long(d, "WINDOW_EVENTS", TCL_WINDOW_EVENTS); - ins_long(d, "FILE_EVENTS", TCL_FILE_EVENTS); - ins_long(d, "TIMER_EVENTS", TCL_TIMER_EVENTS); - ins_long(d, "IDLE_EVENTS", TCL_IDLE_EVENTS); - ins_long(d, "ALL_EVENTS", TCL_ALL_EVENTS); - ins_long(d, "DONT_WAIT", TCL_DONT_WAIT); - ins_string(d, "TK_VERSION", TK_VERSION); - ins_string(d, "TCL_VERSION", TCL_VERSION); - - PyDict_SetItemString(d, "TkappType", (PyObject *)&Tkapp_Type); + Py_INCREF(Tkinter_TclError); + PyModule_AddObject(m, "TclError", Tkinter_TclError); + + PyModule_AddIntConstant(m, "READABLE", TCL_READABLE); + PyModule_AddIntConstant(m, "WRITABLE", TCL_WRITABLE); + PyModule_AddIntConstant(m, "EXCEPTION", TCL_EXCEPTION); + PyModule_AddIntConstant(m, "WINDOW_EVENTS", TCL_WINDOW_EVENTS); + PyModule_AddIntConstant(m, "FILE_EVENTS", TCL_FILE_EVENTS); + PyModule_AddIntConstant(m, "TIMER_EVENTS", TCL_TIMER_EVENTS); + PyModule_AddIntConstant(m, "IDLE_EVENTS", TCL_IDLE_EVENTS); + PyModule_AddIntConstant(m, "ALL_EVENTS", TCL_ALL_EVENTS); + PyModule_AddIntConstant(m, "DONT_WAIT", TCL_DONT_WAIT); + PyModule_AddStringConstant(m, "TK_VERSION", TK_VERSION); + PyModule_AddStringConstant(m, "TCL_VERSION", TCL_VERSION); + + PyModule_AddObject(m, "TkappType", (PyObject *)&Tkapp_Type); if (PyType_Ready(&Tktt_Type) < 0) { Py_DECREF(m); return NULL; } - PyDict_SetItemString(d, "TkttType", (PyObject *)&Tktt_Type); + PyModule_AddObject(m, "TkttType", (PyObject *)&Tktt_Type); Py_TYPE(&PyTclObject_Type) = &PyType_Type; - PyDict_SetItemString(d, "Tcl_Obj", (PyObject *)&PyTclObject_Type); + PyModule_AddObject(m, "Tcl_Obj", (PyObject *)&PyTclObject_Type); #ifdef TK_AQUA /* Tk_MacOSXSetupTkNotifier must be called before Tcl's subsystems |