Commits

Ronald Oussoren committed fa98f8c

Looking up a previously unseen instance method through the class now adds it to the class dict instead of the metaclass dict

Comments (0)

Files changed (1)

pyobjc-core/Modules/objc/objc-class.m

 
 /* FIXME: version of _type_lookup that only looks for instance methods */
 static inline PyObject*
-_type_lookup_instance(PyTypeObject* tp, PyObject* name, PyObject* name_bytes)
+_type_lookup_instance(PyObject* class_dict, PyTypeObject* tp, PyObject* name, PyObject* name_bytes)
 {
 	Py_ssize_t i, n;
 	PyObject *mro, *base, *dict;
 
 
 				/* add to __dict__ 'cache' */
-				if (PyDict_SetItem(dict, name, result) == -1) {
+				if (PyDict_SetItem(class_dict, name, result) == -1) {
 					Py_DECREF(result);
 					return NULL;
 				}
 	}
 
 	if (descr == NULL) {
-		descr = _type_lookup_instance(Py_TYPE(self), name, bytes);
+		descr = _type_lookup_instance(((PyTypeObject*)self)->tp_dict, Py_TYPE(self), name, bytes);
 		if (descr != NULL) {
 			result = descr;
 			descr = NULL;