* Added a new method flag, METH_COEXIST.
* Used the flag to optimize set.__contains__(), dict.__contains__(),
dict.__getitem__(), and list.__getitem__().
diff --git a/Objects/typeobject.c b/Objects/typeobject.c
index e4eadb8..545dba6 100644
--- a/Objects/typeobject.c
+++ b/Objects/typeobject.c
@@ -2792,8 +2792,9 @@
for (; meth->ml_name != NULL; meth++) {
PyObject *descr;
- if (PyDict_GetItemString(dict, meth->ml_name))
- continue;
+ if (PyDict_GetItemString(dict, meth->ml_name) &&
+ !(meth->ml_flags & METH_COEXIST))
+ continue;
if (meth->ml_flags & METH_CLASS) {
if (meth->ml_flags & METH_STATIC) {
PyErr_SetString(PyExc_ValueError,