summaryrefslogtreecommitdiffstats
path: root/Modules/_tkinter.c
diff options
context:
space:
mode:
authorAmaury Forgeot d'Arc <amauryfa@gmail.com>2008-07-02 20:50:16 (GMT)
committerAmaury Forgeot d'Arc <amauryfa@gmail.com>2008-07-02 20:50:16 (GMT)
commite43d33a4db0c0c9afcb70a26f682abfe889e845b (patch)
tree47197bd06fa88bf96cef5f673018d20887fa301c /Modules/_tkinter.c
parent4118174315f4cba03208886af868fe31f1cd5b9d (diff)
downloadcpython-e43d33a4db0c0c9afcb70a26f682abfe889e845b.zip
cpython-e43d33a4db0c0c9afcb70a26f682abfe889e845b.tar.gz
cpython-e43d33a4db0c0c9afcb70a26f682abfe889e845b.tar.bz2
#3247 Get rid of Py_FindMethod; use tp_members instead.
Otherwise dir(_sre.SRE_Match) returns an empty list. First step: handle most occurrences, remove tp_getattr and fill the tp_methods and tp_members slots. Add some test about attribute access.
Diffstat (limited to 'Modules/_tkinter.c')
-rw-r--r--Modules/_tkinter.c50
1 files changed, 34 insertions, 16 deletions
diff --git a/Modules/_tkinter.c b/Modules/_tkinter.c
index cb0ab42..4e36dac 100644
--- a/Modules/_tkinter.c
+++ b/Modules/_tkinter.c
@@ -2327,12 +2327,6 @@ Tktt_Repr(PyObject *self)
return PyUnicode_FromString(buf);
}
-static PyObject *
-Tktt_GetAttr(PyObject *self, char *name)
-{
- return Py_FindMethod(Tktt_methods, self, name);
-}
-
static PyTypeObject Tktt_Type =
{
PyVarObject_HEAD_INIT(NULL, 0)
@@ -2341,7 +2335,7 @@ static PyTypeObject Tktt_Type =
0, /*tp_itemsize */
Tktt_Dealloc, /*tp_dealloc */
0, /*tp_print */
- Tktt_GetAttr, /*tp_getattr */
+ 0, /*tp_getattr */
0, /*tp_setattr */
0, /*tp_compare */
Tktt_Repr, /*tp_repr */
@@ -2349,6 +2343,20 @@ static PyTypeObject Tktt_Type =
0, /*tp_as_sequence */
0, /*tp_as_mapping */
0, /*tp_hash */
+ 0, /*tp_call*/
+ 0, /*tp_str*/
+ 0, /*tp_getattro*/
+ 0, /*tp_setattro*/
+ 0, /*tp_as_buffer*/
+ Py_TPFLAGS_DEFAULT, /*tp_flags*/
+ 0, /*tp_doc*/
+ 0, /*tp_traverse*/
+ 0, /*tp_clear*/
+ 0, /*tp_richcompare*/
+ 0, /*tp_weaklistoffset*/
+ 0, /*tp_iter*/
+ 0, /*tp_iternext*/
+ Tktt_methods, /*tp_methods*/
};
@@ -2671,12 +2679,6 @@ Tkapp_Dealloc(PyObject *self)
DisableEventHook();
}
-static PyObject *
-Tkapp_GetAttr(PyObject *self, char *name)
-{
- return Py_FindMethod(Tkapp_methods, self, name);
-}
-
static PyTypeObject Tkapp_Type =
{
PyVarObject_HEAD_INIT(NULL, 0)
@@ -2685,7 +2687,7 @@ static PyTypeObject Tkapp_Type =
0, /*tp_itemsize */
Tkapp_Dealloc, /*tp_dealloc */
0, /*tp_print */
- Tkapp_GetAttr, /*tp_getattr */
+ 0, /*tp_getattr */
0, /*tp_setattr */
0, /*tp_compare */
0, /*tp_repr */
@@ -2693,6 +2695,20 @@ static PyTypeObject Tkapp_Type =
0, /*tp_as_sequence */
0, /*tp_as_mapping */
0, /*tp_hash */
+ 0, /*tp_call*/
+ 0, /*tp_str*/
+ 0, /*tp_getattro*/
+ 0, /*tp_setattro*/
+ 0, /*tp_as_buffer*/
+ Py_TPFLAGS_DEFAULT, /*tp_flags*/
+ 0, /*tp_doc*/
+ 0, /*tp_traverse*/
+ 0, /*tp_clear*/
+ 0, /*tp_richcompare*/
+ 0, /*tp_weaklistoffset*/
+ 0, /*tp_iter*/
+ 0, /*tp_iternext*/
+ Tkapp_methods, /*tp_methods*/
};
@@ -3026,7 +3042,8 @@ PyInit__tkinter(void)
{
PyObject *m, *d, *uexe, *cexe;
- Py_TYPE(&Tkapp_Type) = &PyType_Type;
+ if (PyType_Ready(&Tkapp_Type) < 0)
+ return NULL;
#ifdef WITH_THREAD
tcl_lock = PyThread_allocate_lock();
@@ -3054,7 +3071,8 @@ PyInit__tkinter(void)
PyDict_SetItemString(d, "TkappType", (PyObject *)&Tkapp_Type);
- Py_TYPE(&Tktt_Type) = &PyType_Type;
+ if (PyType_Ready(&Tktt_Type) < 0)
+ return NULL;
PyDict_SetItemString(d, "TkttType", (PyObject *)&Tktt_Type);
Py_TYPE(&PyTclObject_Type) = &PyType_Type;