Re: [Pyobjc-dev] PythonBrowser example/study + bug report
Brought to you by:
ronaldoussoren
From: Just v. R. <ju...@le...> - 2002-12-01 20:56:03
|
Ronald Oussoren wrote: > I'll look into this. Also the fact that reporting the error actually causes a real crash somehow? In case you missed it: 2002-11-30 15:31:24.633 Console[20835] Exception raised during posting of notification. Ignored. exception: *** NSRunStorage, _NSBlockNumberForIndex(): index (36561) beyond array bounds (36561) I've found another crashing bug: In PythonBrowser.py, if PythonItem doesn't subclass NSObject but object it crashes right away. If I subclass from nothing (a classic class) it crashes later (eg. after clicking). Are crashes expected if Python objects are fed to the ObjC runtime? [error reporting] > What I'm currently thinking of: > > 1) objc.setVerbose(newValue) -> None newValue is a boolean. If > newValue is true the PyObjC runtime is more verbose, this includes > calling PyErr_Print when translating from Python to Objective-C > exceptions. Sounds good. > 2) The exception raised when converting from Python to Objective-C > exceptions should always include the file+line where the exception > was raised. It can't include a proper traceback? (Sorry if this is naive, I know nothing about exceptions in ObjC yet.) > BTW. 'objc.setVerbose' should IMHO be a property ('objc.verbose = 1' > instead of 'objc.setVerbose(1)'), but I'm pretty sure that it is > impossible to add properties to a module without subclassing > types.ModuleType. This is too bad because module-properties would be a > neat way to proxy global variables in Objective-C frameworks. What about an object in the module with a special name, handling the access to globals? On the other hand: wouldn't subclassing the module class also be an opportunity to speedup loading of Foundation and AppKit by doing things lazily? Oh, I don't think we need to subclass module at all: we can just inject an arbitrary object into sys.modules; I just tried it, and even "from FakeModule import *" works just fine. Just |