From 2d493697a69dff967e03a69739c0ac177f8e5203 Mon Sep 17 00:00:00 2001 From: theraven Date: Tue, 19 Jul 2011 11:47:36 +0000 Subject: [PATCH] Work around PyObjC's stupid abuse of the message-send-to-super mechanism. --- sendmsg2.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/sendmsg2.c b/sendmsg2.c index 11f29e5..d85c1d6 100644 --- a/sendmsg2.c +++ b/sendmsg2.c @@ -159,7 +159,21 @@ Slot_t objc_slot_lookup_super(struct objc_super *super, SEL selector) if (0 == result) { // Dtable should always be installed in the superclass - ASSERT(dtable_for_class(class) != uninstalled_dtable); + // Unfortunately, some stupid code (PyObjC) decides to use this + // mechanism for everything + if (dtable_for_class(class) == uninstalled_dtable) + { + if (class_isMetaClass(receiver->isa)) + { + objc_send_initialize(receiver); + } + else + { + objc_send_initialize((id)receiver->isa); + } + objc_send_initialize((id)class); + return objc_slot_lookup_super(super, selector); + } result = &nil_slot; } return result;