[Pyobjc-dev] NSNumber.alloc().initWithFloat_ crashes
Brought to you by:
ronaldoussoren
From: Martina O. <Ma...@Oe...> - 2003-03-02 17:32:30
|
Hi, Apparently the bridge now tries to translate NSNumber to native python types: Python 2.2 (#1, 07/14/02, 23:25:09) [GCC Apple cpp-precomp 6.14] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> from Foundation import * >>> n = NSNumber.numberWithFloat_(1.0) >>> n 1.0 That's nice, now I can get rid of a lot of stupid floatValue() calls. Actually I must remove them, because they no longer work: >>> n.floatValue() Traceback (most recent call last): File "<stdin>", line 1, in ? AttributeError: 'float' object has no attribute 'floatValue' Even worse, the following snippet crashes python, perhaps because it tries to translate an uninitialized NSNumber: >>> m = NSNumber.alloc().initWithFloat_(1.0) 2003-03-02 18:13:34.879 python[1524] Did you forget to nest alloc and init? 2003-03-02 18:13:34.883 python[1524] *** Uncaught exception: <NSInvalidArgumentException> *** -objCType only defined for abstract class. Define -[NSPlaceholderNumber objCType]! Trace/BPT trap Date/Time: 2003-03-02 18:13:35 +0100 OS Version: 10.2.4 (Build 6I32) Host: iBook.local. Command: python PID: 1524 Exception: EXC_BREAKPOINT (0x0006) Code[0]: 0x00000001Code[1]: 0x90844988 Thread 0 Crashed: #0 0x90844988 in _NSRaiseError #1 0x90844810 in +[NSException raise:format:] #2 0x908882a8 in -[NSPlaceholderValue objCType] #3 0x0027093c in -[NSNumber(PyObjCSupport) __pyobjc_PythonObject__] (objc_support.m:70) #4 0x00272368 in pythonify_c_value (objc_support.m:654) #5 0x00284118 in supercall_NSObject_alloc (alloc_hack.m:66) #6 0x0027e4ec in objcsel_call (selector.m:633) #7 0x00045930 in PyObject_Call #8 0x0005df64 in PyEval_GetFuncDesc #9 0x0005b32c in PyEval_EvalCode #10 0x0005c634 in PyEval_EvalCodeEx #11 0x00058a80 in PyEval_EvalCode #12 0x00027e90 in PyRun_FileExFlags #13 0x00026c70 in PyRun_InteractiveOneFlags #14 0x00026a58 in PyRun_InteractiveLoopFlags #15 0x000268f0 in PyRun_AnyFileExFlags #16 0x000069f0 in Py_Main #17 0x00002970 in start #18 0x000027f0 in start PPC Thread State: srr0: 0x90844988 srr1: 0x0002f030 vrsave: 0x00000000 xer: 0x00000000 lr: 0x90844964 ctr: 0x907e4270 mq: 0x00000000 r0: 0x00000000 r1: 0xbffff1d0 r2: 0x2422224d r3: 0xa07ed3b8 r4: 0x9068d51c r5: 0x00000000 r6: 0xbfffeeb0 r7: 0x00000000 r8: 0x00103010 r9: 0xa07e0294 r10: 0x00000001 r11: 0x00000000 r12: 0x2422224d r13: 0x00000083 r14: 0x0011c7fc r15: 0x00000000 r16: 0x00000000 r17: 0x00000000 r18: 0x00000000 r19: 0x0011c7fc r20: 0x005438e3 r21: 0x0010b7e0 r22: 0x00000000 r23: 0x0011c6b0 r24: 0x00000000 r25: 0x00000000 r26: 0x00543660 r27: 0x0046f190 r28: 0xbffff964 r29: 0x0046ede0 r30: 0x001635f0 r31: 0x908448a8 ciao Martina |