#2346/#2347: add py3k warning for __methods__ and __members__. Patch by Jack Diederich.
diff --git a/Objects/methodobject.c b/Objects/methodobject.c
index 5b9a364..16175f9 100644
--- a/Objects/methodobject.c
+++ b/Objects/methodobject.c
@@ -352,8 +352,15 @@
 Py_FindMethodInChain(PyMethodChain *chain, PyObject *self, const char *name)
 {
 	if (name[0] == '_' && name[1] == '_') {
-		if (strcmp(name, "__methods__") == 0)
+		if (strcmp(name, "__methods__") == 0) {
+			if (Py_Py3kWarningFlag) {
+				if (PyErr_Warn(PyExc_DeprecationWarning,
+					       "__methods__ not supported "
+					       "in 3.x") < 0)
+					return NULL;
+			}
 			return listmethodchain(chain);
+		}
 		if (strcmp(name, "__doc__") == 0) {
 			const char *doc = self->ob_type->tp_doc;
 			if (doc != NULL)
diff --git a/Objects/object.c b/Objects/object.c
index a10ac7c..4a66f4f 100644
--- a/Objects/object.c
+++ b/Objects/object.c
@@ -1687,6 +1687,16 @@
 					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);