Commits

Anonymous committed febb72a

2002-1-22: sdm7g
pyobjc/setup.py : added -g flag to compile for debugging
pyobjc/ObjC.m : -v flag now dumps message sends to /tmp file
pyobjc/ObjCObject.m : added ISCLASS test before isKindOfClass -
without check, it crashes on sends to abstract classes
like NSProxy. Removed previous hack that wrongly commented out
some [super forwardInvocation] messages.
pyobjc/Examples/HelloWorld.py : fixed spelling and inserted
missing line.

Comments (0)

Files changed (5)

pyobjc/Examples/HelloWorld.py

     pool = rt.NSAutoreleasePool()
 
     # Load Application Framework:
-    rt.NSBundle.bundleWithPath_('/System/Library/Frameworks/AppKit.framework').load()
+    rt.NSBundle.bundleWithPath_(
+	'/System/Library/Frameworks/AppKit.framework').load()
+
+    NSApp = rt.NSApplication.sharedApplication()
 
     ##! NSApp.setDelegate_( AppDelegate() )
 
     bye.setTarget_ (NSApp)
     bye.setAction_ ('stop:')
     bye.setEnabled_ ( 1 )
-    bye.setTitle_( 'Goobye!' )
+    bye.setTitle_( 'Goodbye!' )
 
     adios = rt.NSSound.alloc()
     adios.initWithContentsOfFile_byReference_( 

pyobjc/OC_PythonObject.m

 	      NS_HANDLER
 		Py_DECREF(args);
 	        fprintf (stderr, "error getting type of arg %d\n", i);
-		//! [super forwardInvocation:invocation];
+		[super forwardInvocation:invocation];
 		return;
 	      NS_ENDHANDLER
 		
 	      else
 		[invocation setReturnValue:retbuffer];
 	    }
-	  return;
         }
     }
 
-  //! [super forwardInvocation:invocation];    
+  [super forwardInvocation:invocation];    
 }    
 
 
   [OC_PythonBundle class];
   
   ObjCObject_initialize();
+
+  // sdm7g 2002-1-22: if -v ($PYVERBOSE) log all message sends to /tmp file
+  // [see:  objc*/runtime/objc-class.m in Darwin sources]
+  if (Py_VerboseFlag) instrumentObjcMessageSends(YES);
   
   if (PyErr_Occurred())
     Py_FatalError ("can't initialize module pyobjc");

pyobjc/ObjCObject.m

   if (self == NULL)
     return NULL;
 
-  if (obj && ([obj isKindOfClass: [NSAutoreleasePool class]] == NO) )
+  /* sdm7g 2002-1-22: isKindOfClass crashes on abstract classes like NSProxy */
+  if (obj &&  !ISCLASS(obj) && 
+      ([obj isKindOfClass: [NSAutoreleasePool class]] == NO) )
     [obj retain];
   
   self->oc_object = obj;
            author = "bbum, SteveM, many others stretching back through the reaches of time...",
            author_email = "bbum@codefab.com",
            url = "http://pyobjc.sourceforge.net/",
-           ext_modules = [Extension("pyobjc", sourceFiles)],
+           ext_modules = [Extension("pyobjc", sourceFiles,
+				   extra_compile_args=["-g"]) ]
            )
 except:
     import sys