#2346/#2347: add py3k warning for __methods__ and __members__. Patch by Jack Diederich.

This commit is contained in:
Georg Brandl 2008-03-21 20:21:46 +00:00
parent 5a44424c5e
commit 07e5681fd3
4 changed files with 30 additions and 1 deletions

View file

@ -1687,6 +1687,16 @@ merge_list_attr(PyObject* dict, PyObject* obj, const char *attrname)
break;
}
}
if (Py_Py3kWarningFlag &&
(strcmp(attrname, "__members__") == 0 ||
strcmp(attrname, "__methods__") == 0)) {
if (PyErr_Warn(PyExc_DeprecationWarning,
"__members__ and __methods__ not supported "
"in 3.x") < 0) {
Py_XDECREF(list);
return -1;
}
}
}
Py_XDECREF(list);