fix an oops

This commit is contained in:
rdb 2011-06-03 09:11:12 +00:00
parent b71ab5d081
commit 61cfd40824
2 changed files with 10 additions and 2 deletions

View File

@ -110,7 +110,11 @@ __setattr__, PyObject *self, const string &attr_name, PyObject *assign) {
// Validate the attribute name.
for (string::const_iterator it = attr_name.begin(); it < attr_name.end(); it++) {
if (*it < 'x' || *it > 'z') {
return NULL;
PyTypeObject *tp = self->ob_type;
PyErr_Format(PyExc_AttributeError,
"'%.100s' object has no attribute '%.200s'",
tp->tp_name, attr_name.c_str());
return -1;
}
}
#endif

View File

@ -124,7 +124,11 @@ __setattr__, PyObject *self, const string &attr_name, PyObject *assign) {
// Validate the attribute name.
for (string::const_iterator it = attr_name.begin(); it < attr_name.end(); it++) {
if (*it < 'w' || *it > 'z') {
return NULL;
PyTypeObject *tp = self->ob_type;
PyErr_Format(PyExc_AttributeError,
"'%.100s' object has no attribute '%.200s'",
tp->tp_name, attr_name.c_str());
return -1;
}
}
#endif