diff options
author | Benjamin Peterson <benjamin@python.org> | 2009-05-24 23:13:32 (GMT) |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2009-05-24 23:13:32 (GMT) |
commit | a7724e59e006e1ca0a12ae6fd2eeaf895833c297 (patch) | |
tree | 71567cff9c13bb16082a48e9ca3bf436bf36eaa4 /Modules | |
parent | 36b6dfca00761f57865067b81c55145d5a507bc6 (diff) | |
download | cpython-a7724e59e006e1ca0a12ae6fd2eeaf895833c297.zip cpython-a7724e59e006e1ca0a12ae6fd2eeaf895833c297.tar.gz cpython-a7724e59e006e1ca0a12ae6fd2eeaf895833c297.tar.bz2 |
stop using Py_FindMethod
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/threadmodule.c | 30 |
1 files changed, 22 insertions, 8 deletions
diff --git a/Modules/threadmodule.c b/Modules/threadmodule.c index a87ddb3..e7638bb 100644 --- a/Modules/threadmodule.c +++ b/Modules/threadmodule.c @@ -116,15 +116,9 @@ static PyMethodDef lock_methods[] = { METH_VARARGS, acquire_doc}, {"__exit__", (PyCFunction)lock_PyThread_release_lock, METH_VARARGS, release_doc}, - {NULL, NULL} /* sentinel */ + {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 */ + 0, /* 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 * @@ -709,6 +721,8 @@ initthread(void) ThreadError = PyErr_NewException("thread.error", NULL, NULL); PyDict_SetItemString(d, "error", ThreadError); Locktype.tp_doc = lock_doc; + if (PyType_Ready(&Locktype) < 0) + return; Py_INCREF(&Locktype); PyDict_SetItemString(d, "LockType", (PyObject *)&Locktype); |