summaryrefslogtreecommitdiff
path: root/Modules/selectmodule.c
diff options
context:
space:
mode:
authorAmaury Forgeot d'Arc <amauryfa@gmail.com>2008-07-02 20:50:16 +0000
committerAmaury Forgeot d'Arc <amauryfa@gmail.com>2008-07-02 20:50:16 +0000
commitcd1275572ffaecd1e8883e47063a87c3d9c5c232 (patch)
tree8447df4c229201ee4cc886ddc9b9132fb079032a /Modules/selectmodule.c
parent02e594752bb329262dfc1aec3cf093f4a6d6da32 (diff)
downloadcpython-cd1275572ffaecd1e8883e47063a87c3d9c5c232.tar.gz
#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/selectmodule.c')
-rw-r--r--Modules/selectmodule.c25
1 files changed, 17 insertions, 8 deletions
diff --git a/Modules/selectmodule.c b/Modules/selectmodule.c
index f1c71e43df..daabf03ac2 100644
--- a/Modules/selectmodule.c
+++ b/Modules/selectmodule.c
@@ -625,12 +625,6 @@ poll_dealloc(pollObject *self)
PyObject_Del(self);
}
-static PyObject *
-poll_getattr(pollObject *self, char *name)
-{
- return Py_FindMethod(poll_methods, (PyObject *)self, name);
-}
-
static PyTypeObject poll_Type = {
/* The ob_type field must be initialized in the module init function
* to be portable to Windows without using C++. */
@@ -641,7 +635,7 @@ static PyTypeObject poll_Type = {
/* methods */
(destructor)poll_dealloc, /*tp_dealloc*/
0, /*tp_print*/
- (getattrfunc)poll_getattr, /*tp_getattr*/
+ 0, /*tp_getattr*/
0, /*tp_setattr*/
0, /*tp_compare*/
0, /*tp_repr*/
@@ -649,6 +643,20 @@ static PyTypeObject poll_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*/
+ poll_methods, /*tp_methods*/
};
PyDoc_STRVAR(poll_doc,
@@ -1764,7 +1772,8 @@ PyInit_select(void)
#else
{
#endif
- Py_TYPE(&poll_Type) = &PyType_Type;
+ if (PyType_Ready(&poll_Type) < 0)
+ return NULL;
PyModule_AddIntConstant(m, "POLLIN", POLLIN);
PyModule_AddIntConstant(m, "POLLPRI", POLLPRI);
PyModule_AddIntConstant(m, "POLLOUT", POLLOUT);