summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorCollin Winter <collinw@gmail.com>2007-08-14 17:47:27 (GMT)
committerCollin Winter <collinw@gmail.com>2007-08-14 17:47:27 (GMT)
commitee634a4013ff6321aecd132498721ebfb734a4cc (patch)
treedb6629cb7d2c93ddf37b88a2ba526465effff6e6 /Python
parent3a38c913425aad7a494661560eda4d29389868b8 (diff)
downloadcpython-ee634a4013ff6321aecd132498721ebfb734a4cc.zip
cpython-ee634a4013ff6321aecd132498721ebfb734a4cc.tar.gz
cpython-ee634a4013ff6321aecd132498721ebfb734a4cc.tar.bz2
Get rid of traceback.c:tb_getattr in favor of marking the members as READONLY.
Diffstat (limited to 'Python')
-rw-r--r--Python/traceback.c22
1 files changed, 3 insertions, 19 deletions
diff --git a/Python/traceback.c b/Python/traceback.c
index 0e24196..aa99ab4 100644
--- a/Python/traceback.c
+++ b/Python/traceback.c
@@ -19,22 +19,6 @@ static PyMemberDef tb_memberlist[] = {
{NULL} /* Sentinel */
};
-/* XXX(nnorwitz): can we get rid of tb_getattr and use tp_members? */
-static PyObject *
-tb_getattr(PyTracebackObject *tb, char *name)
-{
- int i;
- for (i = 0; tb_memberlist[i].name != NULL; i++) {
- if (strcmp(name, tb_memberlist[i].name) == 0)
- return PyMember_GetOne((const char *)tb,
- tb_memberlist + i);
- }
- PyErr_Format(PyExc_AttributeError,
- "'%.50s' object has no attribute '%.400s'",
- Py_Type(tb)->tp_name, name);
- return NULL;
-}
-
static void
tb_dealloc(PyTracebackObject *tb)
{
@@ -68,7 +52,7 @@ PyTypeObject PyTraceBack_Type = {
0,
(destructor)tb_dealloc, /*tp_dealloc*/
0, /*tp_print*/
- (getattrfunc)tb_getattr, /*tp_getattr*/
+ 0, /*tp_getattr*/
0, /*tp_setattr*/
0, /*tp_compare*/
0, /*tp_repr*/
@@ -78,7 +62,7 @@ PyTypeObject PyTraceBack_Type = {
0, /* tp_hash */
0, /* tp_call */
0, /* tp_str */
- 0, /* tp_getattro */
+ PyObject_GenericGetAttr, /* tp_getattro */
0, /* tp_setattro */
0, /* tp_as_buffer */
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,/* tp_flags */
@@ -90,7 +74,7 @@ PyTypeObject PyTraceBack_Type = {
0, /* tp_iter */
0, /* tp_iternext */
0, /* tp_methods */
- 0, /* tp_members */
+ tb_memberlist, /* tp_members */
0, /* tp_getset */
0, /* tp_base */
0, /* tp_dict */