diff options
author | Amaury Forgeot d'Arc <amauryfa@gmail.com> | 2008-07-02 20:50:16 +0000 |
---|---|---|
committer | Amaury Forgeot d'Arc <amauryfa@gmail.com> | 2008-07-02 20:50:16 +0000 |
commit | e43d33a4db0c0c9afcb70a26f682abfe889e845b (patch) | |
tree | 47197bd06fa88bf96cef5f673018d20887fa301c /Modules/_threadmodule.c | |
parent | 4118174315f4cba03208886af868fe31f1cd5b9d (diff) | |
download | cpython-git-e43d33a4db0c0c9afcb70a26f682abfe889e845b.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/_threadmodule.c')
-rw-r--r-- | Modules/_threadmodule.c | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/Modules/_threadmodule.c b/Modules/_threadmodule.c index d2299aa4fb..f0d03d7436 100644 --- a/Modules/_threadmodule.c +++ b/Modules/_threadmodule.c @@ -119,12 +119,6 @@ static PyMethodDef lock_methods[] = { {NULL, NULL} /* sentinel */ }; -static PyObject * -lock_getattr(lockobject *self, char *name) -{ - return Py_FindMethod(lock_methods, (PyObject *)self, name); -} - static PyTypeObject Locktype = { PyVarObject_HEAD_INIT(&PyType_Type, 0) "_thread.lock", /*tp_name*/ @@ -133,10 +127,28 @@ static PyTypeObject Locktype = { /* methods */ (destructor)lock_dealloc, /*tp_dealloc*/ 0, /*tp_print*/ - (getattrfunc)lock_getattr, /*tp_getattr*/ + 0, /*tp_getattr*/ 0, /*tp_setattr*/ 0, /*tp_compare*/ 0, /*tp_repr*/ + 0, /*tp_as_number*/ + 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*/ + lock_methods, /*tp_methods*/ }; static lockobject * |