[Python-checkins] r72903 - python/trunk/Modules/threadmodule.c
benjamin.peterson
python-checkins at python.org
Mon May 25 01:13:33 CEST 2009
Author: benjamin.peterson
Date: Mon May 25 01:13:32 2009
New Revision: 72903
Log:
stop using Py_FindMethod
Modified:
python/trunk/Modules/threadmodule.c
Modified: python/trunk/Modules/threadmodule.c
==============================================================================
--- python/trunk/Modules/threadmodule.c (original)
+++ python/trunk/Modules/threadmodule.c Mon May 25 01:13:32 2009
@@ -116,15 +116,9 @@
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 @@
/* 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 @@
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);
More information about the Python-checkins
mailing list