summaryrefslogtreecommitdiffstats
path: root/PC/_winreg.c
diff options
context:
space:
mode:
Diffstat (limited to 'PC/_winreg.c')
-rw-r--r--PC/_winreg.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/PC/_winreg.c b/PC/_winreg.c
index c294653..135be32 100644
--- a/PC/_winreg.c
+++ b/PC/_winreg.c
@@ -473,8 +473,8 @@ PyTypeObject PyHKEY_Type =
#define OFF(e) offsetof(PyHKEYObject, e)
-static struct memberlist PyHKEY_memberlist[] = {
- {"handle", T_INT, OFF(hkey)},
+static PyMemberDef PyHKEY_memberlist[] = {
+ {"handle", T_INT, OFF(hkey), READONLY},
{NULL} /* Sentinel */
};
@@ -523,7 +523,10 @@ PyHKEY_getattr(PyObject *self, const char *name)
PyErr_Clear();
if (strcmp(name, "handle") == 0)
return PyLong_FromVoidPtr(((PyHKEYObject *)self)->hkey);
- return PyMember_Get((char *)self, PyHKEY_memberlist, name);
+ PyErr_Format(PyExc_AttributeError,
+ "'%.50s' object has no attribute '%.400s'",
+ Py_Type(self)->tp_name, name);
+ return NULL;
}
/************************************************************************