pyobjc-dev Mailing List for PyObjC (Page 19)
Brought to you by:
ronaldoussoren
You can subscribe to this list here.
2000 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(9) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2001 |
Jan
(1) |
Feb
(2) |
Mar
(3) |
Apr
(30) |
May
(18) |
Jun
|
Jul
(4) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2002 |
Jan
(7) |
Feb
(2) |
Mar
(1) |
Apr
|
May
|
Jun
(3) |
Jul
(13) |
Aug
|
Sep
(23) |
Oct
(180) |
Nov
(291) |
Dec
(95) |
2003 |
Jan
(338) |
Feb
(352) |
Mar
(97) |
Apr
(46) |
May
(226) |
Jun
(184) |
Jul
(145) |
Aug
(141) |
Sep
(69) |
Oct
(161) |
Nov
(96) |
Dec
(90) |
2004 |
Jan
(66) |
Feb
(87) |
Mar
(98) |
Apr
(132) |
May
(115) |
Jun
(68) |
Jul
(150) |
Aug
(92) |
Sep
(59) |
Oct
(52) |
Nov
(17) |
Dec
(75) |
2005 |
Jan
(84) |
Feb
(191) |
Mar
(133) |
Apr
(114) |
May
(158) |
Jun
(185) |
Jul
(62) |
Aug
(28) |
Sep
(36) |
Oct
(88) |
Nov
(65) |
Dec
(43) |
2006 |
Jan
(85) |
Feb
(62) |
Mar
(92) |
Apr
(75) |
May
(68) |
Jun
(101) |
Jul
(73) |
Aug
(37) |
Sep
(91) |
Oct
(65) |
Nov
(30) |
Dec
(39) |
2007 |
Jan
(24) |
Feb
(28) |
Mar
(10) |
Apr
(2) |
May
(18) |
Jun
(16) |
Jul
(21) |
Aug
(6) |
Sep
(30) |
Oct
(31) |
Nov
(153) |
Dec
(31) |
2008 |
Jan
(63) |
Feb
(70) |
Mar
(47) |
Apr
(24) |
May
(59) |
Jun
(22) |
Jul
(12) |
Aug
(7) |
Sep
(14) |
Oct
(26) |
Nov
(5) |
Dec
(5) |
2009 |
Jan
(10) |
Feb
(41) |
Mar
(70) |
Apr
(88) |
May
(49) |
Jun
(62) |
Jul
(34) |
Aug
(15) |
Sep
(55) |
Oct
(40) |
Nov
(67) |
Dec
(21) |
2010 |
Jan
(60) |
Feb
(17) |
Mar
(26) |
Apr
(26) |
May
(29) |
Jun
(4) |
Jul
(21) |
Aug
(21) |
Sep
(10) |
Oct
(12) |
Nov
(3) |
Dec
(19) |
2011 |
Jan
(3) |
Feb
(13) |
Mar
(8) |
Apr
(8) |
May
(17) |
Jun
(20) |
Jul
(21) |
Aug
(7) |
Sep
|
Oct
|
Nov
(9) |
Dec
(11) |
2012 |
Jan
(3) |
Feb
|
Mar
|
Apr
(5) |
May
(4) |
Jun
(14) |
Jul
(5) |
Aug
(2) |
Sep
(15) |
Oct
(2) |
Nov
(23) |
Dec
(1) |
2013 |
Jan
(8) |
Feb
(1) |
Mar
|
Apr
|
May
(5) |
Jun
(1) |
Jul
(5) |
Aug
(4) |
Sep
|
Oct
(12) |
Nov
(10) |
Dec
(3) |
2014 |
Jan
(7) |
Feb
(14) |
Mar
(2) |
Apr
|
May
(2) |
Jun
(11) |
Jul
(10) |
Aug
(4) |
Sep
|
Oct
(8) |
Nov
(1) |
Dec
(2) |
2015 |
Jan
(9) |
Feb
(7) |
Mar
(1) |
Apr
|
May
(7) |
Jun
|
Jul
(5) |
Aug
(6) |
Sep
|
Oct
(1) |
Nov
(4) |
Dec
|
2016 |
Jan
(1) |
Feb
(1) |
Mar
(4) |
Apr
(2) |
May
(1) |
Jun
|
Jul
(6) |
Aug
(8) |
Sep
(21) |
Oct
(17) |
Nov
|
Dec
(36) |
2017 |
Jan
(6) |
Feb
(2) |
Mar
(4) |
Apr
(2) |
May
|
Jun
|
Jul
(1) |
Aug
|
Sep
(1) |
Oct
|
Nov
(1) |
Dec
(6) |
2018 |
Jan
(2) |
Feb
(3) |
Mar
(3) |
Apr
(14) |
May
(2) |
Jun
(2) |
Jul
(4) |
Aug
(3) |
Sep
(6) |
Oct
(16) |
Nov
(1) |
Dec
(6) |
2019 |
Jan
(3) |
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
|
Jul
(2) |
Aug
|
Sep
|
Oct
(6) |
Nov
|
Dec
|
2020 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
(2) |
Jun
(1) |
Jul
(7) |
Aug
(1) |
Sep
(1) |
Oct
|
Nov
(2) |
Dec
(1) |
2021 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
(2) |
Jul
|
Aug
(5) |
Sep
(1) |
Oct
|
Nov
(1) |
Dec
|
2023 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
|
Sep
(2) |
Oct
|
Nov
|
Dec
|
2025 |
Jan
(2) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Ken T. <ke...@co...> - 2011-12-28 08:07:53
|
On Dec 27, 2011, at 3:08 PM, Marc Van Olmen wrote: > I looked around the web and more specific stack overflow: I was hoping if there is something I can do to have a better stack trace from pyobjc/python. > > For example my end users send me this, after a hard crash. > > 0 libobjc.A.dylib 0x99b51c22 (anonymous namespace)::AutoreleasePoolPage::pop(void*) + 350 > 1 com.apple.CoreFoundation 0x97b2c515 _CFAutoreleasePoolPop + 53 > 2 com.apple.Foundation 0x96316b87 -[NSAutoreleasePool release] + 131 > 3 com.apple.CoreFoundation 0x97b01749 CFRelease + 169 > 4 _objc.so 0x04019c21 object_dealloc + 257 > 5 org.python.python 0x01c6e2cf subtype_dealloc + 575 > 6 org.python.python 0x01c3a041 frame_dealloc + 385 > 7 org.python.python 0x01ced87c tb_dealloc + 156 > 8 org.python.python 0x01ced88c tb_dealloc + 172 > 9 org.python.python 0x01c52179 PyDict_DelItem + 249 > 10 org.python.python 0x01c52251 PyDict_DelItemString + 49 > 11 org.python.python 0x01cb940a PyEval_EvalFrameEx + 4810 > 12 org.python.python 0x01cbd6a6 PyEval_EvalFrameEx + 21862 > 13 org.python.python 0x01cbd6a6 PyEval_EvalFrameEx + 21862 > 14 org.python.python 0x01cbd6a6 PyEval_EvalFrameEx + 21862 > 15 org.python.python 0x01cbd6a6 PyEval_EvalFrameEx + 21862 > 16 org.python.python 0x01cbee9d PyEval_EvalCodeEx + 2109 > 17 org.python.python 0x01c3ba36 function_call + 166 > 18 org.python.python 0x01c0a315 PyObject_Call + 85 > 19 org.python.python 0x01c1c8e6 instancemethod_call + 422 > 20 org.python.python 0x01c0a315 PyObject_Call + 85 > 21 org.python.python 0x01cb717e PyEval_CallObjectWithKeywords + 78 > 22 org.python.python 0x01cf89d6 t_bootstrap + 70 > 23 libsystem_c.dylib 0x957c2ed9 _pthread_start + 335 > 24 libsystem_c.dylib 0x957c66de thread_start + 34 > > > Would be nice to know which method and object was called at > > PyEval_EvalFrameEx + 21862 > > for example. I assume you know that "PyEval_EvalFrameEx + 21862" doesn't correspond to any particular Python code. Since Python is running as an interpreter, the Python code is purely data and doesn't correspond to any machine instructions. Therefore, the stack trace doesn't "see" it. It's only seeing the Python interpreter's functions. So, you're asking for the crash reporter to look into the data being used by a function, not just translating the function's address to a symbol. Certainly, there's no way to coax the crash reporter to do that. Likewise, there's no way to deduce the Python code being executed just by analyzing a crash report. Since the crash appears to be due to an over-release, you can try to get more information about the specific object using the "zombies" facilities of the frameworks. If the issue is reproducible, you can ask your users to run your app with certain environment variables set, such as: CFZombieLevel=19 NSZombieEnabled=YES /Applications/YourApp.app/Contents/MacOS/YourApp (I'm not actually certain that the "CFZombieLevel=19" is desirable. You might have them try with and without, if they're willing.) That should at least cause a better diagnostic message to be printed to the console log at the time of the crash. I believe that messaging a zombie triggers a SIGTRAP these days instead of raising an exception. The latter would have been nice in that it might have been translated into a Python exception and provoked Python into dumping a backtrace. Instead, the SIGTRAP will just crash your app in a slightly different way than the above. However, you may be able to translate the SIGTRAP into a Python exception by setting a Python signal handler for SIGTRAP. That would get you a better backtrace from zombies. By the way, you've excerpted a crash report. You may have left out some important information about the specific nature of the crash. Also, if you haven't already, you should ask your users if anything was written to the console log at the same time as the crash. Good luck, Ken |
From: Marc V. O. <mar...@gm...> - 2011-12-27 21:08:42
|
hi, I looked around the web and more specific stack overflow: I was hoping if there is something I can do to have a better stack trace from pyobjc/python. For example my end users send me this, after a hard crash. 0 libobjc.A.dylib 0x99b51c22 (anonymous namespace)::AutoreleasePoolPage::pop(void*) + 350 1 com.apple.CoreFoundation 0x97b2c515 _CFAutoreleasePoolPop + 53 2 com.apple.Foundation 0x96316b87 -[NSAutoreleasePool release] + 131 3 com.apple.CoreFoundation 0x97b01749 CFRelease + 169 4 _objc.so 0x04019c21 object_dealloc + 257 5 org.python.python 0x01c6e2cf subtype_dealloc + 575 6 org.python.python 0x01c3a041 frame_dealloc + 385 7 org.python.python 0x01ced87c tb_dealloc + 156 8 org.python.python 0x01ced88c tb_dealloc + 172 9 org.python.python 0x01c52179 PyDict_DelItem + 249 10 org.python.python 0x01c52251 PyDict_DelItemString + 49 11 org.python.python 0x01cb940a PyEval_EvalFrameEx + 4810 12 org.python.python 0x01cbd6a6 PyEval_EvalFrameEx + 21862 13 org.python.python 0x01cbd6a6 PyEval_EvalFrameEx + 21862 14 org.python.python 0x01cbd6a6 PyEval_EvalFrameEx + 21862 15 org.python.python 0x01cbd6a6 PyEval_EvalFrameEx + 21862 16 org.python.python 0x01cbee9d PyEval_EvalCodeEx + 2109 17 org.python.python 0x01c3ba36 function_call + 166 18 org.python.python 0x01c0a315 PyObject_Call + 85 19 org.python.python 0x01c1c8e6 instancemethod_call + 422 20 org.python.python 0x01c0a315 PyObject_Call + 85 21 org.python.python 0x01cb717e PyEval_CallObjectWithKeywords + 78 22 org.python.python 0x01cf89d6 t_bootstrap + 70 23 libsystem_c.dylib 0x957c2ed9 _pthread_start + 335 24 libsystem_c.dylib 0x957c66de thread_start + 34 Would be nice to know which method and object was called at PyEval_EvalFrameEx + 21862 for example. Marc |
From: Trevor B. <mr...@gm...> - 2011-12-08 17:14:52
|
> Multiprocessing uses fork+exec on windows, because those aren't > separate system calls there but AFAIK you cannot force the > multiprocessing library to do the same on Unix platforms. > > Could you file a bug on python's tracker about the problem you ran > into? A demo program that only uses the stdlib would be great > (possibly something using Tkinter), but isn't required. Sure, I can file a bug with them. Before I do that, I'd like to try to figure out a solution. Here's my problem: I'm writing a cross-platform PyGTK application. The main thread does windowing, and there are two secondary threads: one for USB communication (PyUSB), and one for text to speech (pyttsx). Although I would prefer true multiprocessing, the GIL isn't the end of the world here, so threading will suffice. It currently works in Linux and Windows with threading or multiprocessing, but fails in OS X with both. The multiprocessing problem makes sense, it's a limitation of Apple's Foundation and CPython's implementation. For threading, I feel like there is probably a way to get it to work, but I don't fully understand it. I have traced the pyttsx code a bit, and found what is happening: 1) When you launch the pyttsx processing loop, it calls AppHelper.runConsoleEventLoop() 2) The sound plays correctly 3) When the utterance is finished, pyttsx stops its processing loop by calling AppHelper.stopEventLoop() 4) In PyObjC, stopEventLoop() checks to see if there is a valid "currentRunLoopStopper()" -- it does not find one, but does find a valid NSApp(), which causes it to run NSApp()._terminate_() and kill my application. Here's another crazy tip: "import gtk" makes pyttsx stop working even in the main thread. Just importing it, so its module __init__ must be doing something. I don't fully understand NSRunLoops and how to manage them in threads, nor the interaction between that and Python "threads". Here's my test code: https://gist.github.com/1447666 Do you have any ideas on what I could try to get this working? Thanks, Trevor |
From: Ronald O. <ron...@ma...> - 2011-12-08 15:07:25
|
On 7 Dec, 2011, at 23:54, Trevor Bentley wrote: > I found a bunch of hits for this on Google, but no answers: > > I am working on a Python application that uses the multiprocessing library. I am trying to spawn a process and perform text-to-speech with pyttsx, but I get the dreaded __THE_PROCESS_HAS_FORKED_AND_YOU_CANNOT_USE_THIS_COREFOUNDATION_FUNCTIONALITY___YOU_MUST_EXEC__() error. Most of Apple's frameworks beyond the basic Unix tools require that you child proceses immediately call execv() instead of forking of a child and doing work there as multiprocessing does. > > Is there any way to get this working, short of switching back to threads? I see that the 'correct' way is to fork() and exec(), but I don't see any way to make that compatible with the multiprocessing module's API. Multiprocessing uses fork+exec on windows, because those aren't separate system calls there but AFAIK you cannot force the multiprocessing library to do the same on Unix platforms. Could you file a bug on python's tracker about the problem you ran into? A demo program that only uses the stdlib would be great (possibly something using Tkinter), but isn't required. Ronald > > Thanks, > > -Trevor > > ------------------------------------------------------------------------------ > Cloud Services Checklist: Pricing and Packaging Optimization > This white paper is intended to serve as a reference, checklist and point of > discussion for anyone considering optimizing the pricing and packaging model > of a cloud services business. Read Now! > http://www.accelacomm.com/jaw/sfnl/114/51491232/_______________________________________________ > Pyobjc-dev mailing list > Pyo...@li... > https://lists.sourceforge.net/lists/listinfo/pyobjc-dev |
From: Aahz <aa...@py...> - 2011-12-08 00:05:01
|
On Wed, Dec 07, 2011, Trevor Bentley wrote: > > I found a bunch of hits for this on Google, but no answers: > > I am working on a Python application that uses the multiprocessing library. > I am trying to spawn a process and perform text-to-speech with pyttsx, but > I get the > dreaded __THE_PROCESS_HAS_FORKED_AND_YOU_CANNOT_USE_THIS_COREFOUNDATION_FUNCTIONALITY___YOU_MUST_EXEC__() > error. > > Is there any way to get this working, short of switching back to threads? > I see that the 'correct' way is to fork() and exec(), but I don't see any > way to make that compatible with the multiprocessing module's API. You could do something other than multiprocessing module to access another process (socket to me!). Depends how much a problem the GIL is for you. -- Aahz (aa...@py...) <*> http://www.pythoncraft.com/ "....Normal is what cuts off your sixth finger and your tail..." --Siobhan |
From: Trevor B. <mr...@gm...> - 2011-12-07 22:54:08
|
I found a bunch of hits for this on Google, but no answers: I am working on a Python application that uses the multiprocessing library. I am trying to spawn a process and perform text-to-speech with pyttsx, but I get the dreaded __THE_PROCESS_HAS_FORKED_AND_YOU_CANNOT_USE_THIS_COREFOUNDATION_FUNCTIONALITY___YOU_MUST_EXEC__() error. Is there any way to get this working, short of switching back to threads? I see that the 'correct' way is to fork() and exec(), but I don't see any way to make that compatible with the multiprocessing module's API. Thanks, -Trevor |
From: Marc V. O. <mar...@gm...> - 2011-12-01 21:34:48
|
Aahz Regarding your suggestion, there is helper function that does that: Just for those googling for answers:, I can also add that from PyObjCTools.Conversion import fromPythonDecimal Does this conversion for you from Decimal To NSDecimalNumber. Code is located at: pyobjc-framework-Cocoa/Lib/PyObjCTools/Conversion.py On Thu, Dec 1, 2011 at 8:06 AM, Marc Van Olmen <mar...@gm...>wrote: > hi Aahz, > > i got an answer offline that confirmed a bug in Lion: > > :>>> aNSDecimalNumber.compare_(aPythonDecimal) >> >> This also causes infinite recusion, this time on the Python side. With >> some luck it is related to the issue you ran into using bindings. > > > I currently found a workaround in my code. I haven't tried yours yet. > > Thanks for the input! > > marc > > > On Tue, Nov 29, 2011 at 9:17 PM, Aahz <aa...@py...> wrote: > >> On Tue, Nov 22, 2011, Marc Van Olmen wrote: >> > >> > for our project we haven't upgraded to latest version of pyobjc I just >> > notice we run with 2.2b3 but we have the following bug on Lion Only: >> > >> > When bindings try to compare a decimal number that originally came from >> > Python code. It goes in endless recursive calls... >> >> Nobody else has responded, so I'll just suggest that you should >> explicitly convert between Python Decimal and NSDecimalNumber. >> -- >> Aahz (aa...@py...) <*> >> http://www.pythoncraft.com/ >> >> "....Normal is what cuts off your sixth finger and your tail..." >> --Siobhan >> > > |
From: Marc V. O. <mar...@gm...> - 2011-12-01 13:06:43
|
hi Aahz, i got an answer offline that confirmed a bug in Lion: :>>> aNSDecimalNumber.compare_(aPythonDecimal) > > This also causes infinite recusion, this time on the Python side. With > some luck it is related to the issue you ran into using bindings. I currently found a workaround in my code. I haven't tried yours yet. Thanks for the input! marc On Tue, Nov 29, 2011 at 9:17 PM, Aahz <aa...@py...> wrote: > On Tue, Nov 22, 2011, Marc Van Olmen wrote: > > > > for our project we haven't upgraded to latest version of pyobjc I just > > notice we run with 2.2b3 but we have the following bug on Lion Only: > > > > When bindings try to compare a decimal number that originally came from > > Python code. It goes in endless recursive calls... > > Nobody else has responded, so I'll just suggest that you should > explicitly convert between Python Decimal and NSDecimalNumber. > -- > Aahz (aa...@py...) <*> > http://www.pythoncraft.com/ > > "....Normal is what cuts off your sixth finger and your tail..." --Siobhan > |
From: Aahz <aa...@py...> - 2011-11-30 02:18:00
|
On Tue, Nov 22, 2011, Marc Van Olmen wrote: > > for our project we haven't upgraded to latest version of pyobjc I just > notice we run with 2.2b3 but we have the following bug on Lion Only: > > When bindings try to compare a decimal number that originally came from > Python code. It goes in endless recursive calls... Nobody else has responded, so I'll just suggest that you should explicitly convert between Python Decimal and NSDecimalNumber. -- Aahz (aa...@py...) <*> http://www.pythoncraft.com/ "....Normal is what cuts off your sixth finger and your tail..." --Siobhan |
From: Ronald O. <ron...@ma...> - 2011-11-24 14:17:35
|
On 11 Nov, 2011, at 1:52, Lee Treveil wrote: > Are there going to be any bindings implemented for this framework? Probably, I don't know when though. Ronald |
From: Marc V. O. <mar...@gm...> - 2011-11-22 17:37:35
|
hi, for our project we haven't upgraded to latest version of pyobjc I just notice we run with 2.2b3 but we have the following bug on Lion Only: When bindings try to compare a decimal number that originally came from Python code. It goes in endless recursive calls... .... (this last few lines are repeated over and over again... #3515 0x02edf84d in _ffi_call_SYSV at x86-darwin.S:74 #3516 0x02edfc01 in ffi_call #3517 0x02ef8d79 in PyObjCFFI_Caller #3518 0x02f1ddbd in objcsel_call #3519 0x0289f315 in PyObject_Call #3520 0x02950677 in PyEval_EvalFrameEx #3521 0x02953e9d in PyEval_EvalCodeEx #3522 0x028d0a36 in function_call #3523 0x0289f315 in PyObject_Call #3524 0x028b18e6 in instancemethod_call #3525 0x0289f315 in PyObject_Call #3526 0x0290706b in half_richcompare #3527 0x0290714b in slot_tp_richcompare #3528 0x028e8dd7 in try_rich_compare #3529 0x028eb60e in PyObject_Compare #3530 0x02f11f14 in -[OC_PythonNumber compare:] #3531 0x94ea8f68 in -[NSDecimalNumber compare:] #3532 0x94f0dc7c in -[NSDecimalNumber isEqual:] #3533 0x02edf84d in _ffi_call_SYSV at x86-darwin.S:74 #3534 0x02edfc01 in ffi_call #3535 0x02ef8d79 in PyObjCFFI_Caller #3536 0x02f1ddbd in objcsel_call #3537 0x0289f315 in PyObject_Call #3538 0x02950677 in PyEval_EvalFrameEx #3539 0x02953e9d in PyEval_EvalCodeEx #3540 0x028d0a36 in function_call #3541 0x0289f315 in PyObject_Call #3542 0x028b18e6 in instancemethod_call #3543 0x0289f315 in PyObject_Call #3544 0x0290706b in half_richcompare #3545 0x0290714b in slot_tp_richcompare #3546 0x028e8dd7 in try_rich_compare #3547 0x028eb60e in PyObject_Compare #3548 0x02f11f14 in -[OC_PythonNumber compare:] #3549 0x94ea8f68 in -[NSDecimalNumber compare:] #3550 0x94f0dc7c in -[NSDecimalNumber isEqual:] #3551 0x02edf84d in _ffi_call_SYSV at x86-darwin.S:74 #3552 0x02edfc01 in ffi_call #3553 0x02ef8d79 in PyObjCFFI_Caller #3554 0x02f1ddbd in objcsel_call #3555 0x0289f315 in PyObject_Call #3556 0x02950677 in PyEval_EvalFrameEx #3557 0x02953e9d in PyEval_EvalCodeEx #3558 0x028d0a36 in function_call #3559 0x0289f315 in PyObject_Call #3560 0x028b18e6 in instancemethod_call #3561 0x0289f315 in PyObject_Call #3562 0x0290706b in half_richcompare #3563 0x0290714b in slot_tp_richcompare #3564 0x028e8dd7 in try_rich_compare #3565 0x028eb60e in PyObject_Compare #3566 0x02f11f14 in -[OC_PythonNumber compare:] #3567 0x94ea8f68 in -[NSDecimalNumber compare:] #3568 0x94f0dc7c in -[NSDecimalNumber isEqual:] #3569 0x02edf84d in _ffi_call_SYSV at x86-darwin.S:74 #3570 0x02edfc01 in ffi_call #3571 0x02ef8d79 in PyObjCFFI_Caller #3572 0x02f1ddbd in objcsel_call #3573 0x0289f315 in PyObject_Call #3574 0x02950677 in PyEval_EvalFrameEx #3575 0x02953e9d in PyEval_EvalCodeEx #3576 0x028d0a36 in function_call #3577 0x0289f315 in PyObject_Call #3578 0x028b18e6 in instancemethod_call #3579 0x0289f315 in PyObject_Call #3580 0x0290706b in half_richcompare #3581 0x0290714b in slot_tp_richcompare #3582 0x028e8dd7 in try_rich_compare #3583 0x028eb60e in PyObject_Compare #3584 0x02f11f14 in -[OC_PythonNumber compare:] #3585 0x94ea8f68 in -[NSDecimalNumber compare:] #3586 0x94f0dc7c in -[NSDecimalNumber isEqual:] #3587 0x98cc98cd in _NSValuesAreEqual #3588 0x993a6ccb in -[NSValueBinder _validateDisplayValue] #3589 0x993a5471 in -[NSValueBinder validateAndCommitValueInEditor:editingIsEnding:errorUserInterfaceHandled:] #3590 0x993ea198 in -[_NSBindingAdaptor _validateAndCommitValueInEditor:editingIsEnding:errorUserInterfaceHandled:bindingAdaptor:] #3591 0x993ea2bf in -[_NSBindingAdaptor validateAndCommitValueInEditor:editingIsEnding:errorUserInterfaceHandled:] #3592 0x992f343e in -[NSTextField textShouldEndEditing:] Was this bug addressed already in subsequently releases? Thanks Marc Van Olmen |
From: Ronald O. <ron...@ma...> - 2011-11-22 16:04:19
|
On 22 Nov, 2011, at 16:50, Robert Klep wrote: > Ronald Oussoren <ron...@ma...> wrote on Tue Nov 22 2011 at 16:44:55: >> >> What happens when you add "os.delenv('PYOBJC_BUNDLE_ADDRESS')" before you try to open the bundle? > > Great, that solves the problem! Great to hear that. I've filed a bug in my py2app tracker (<https://bitbucket.org/ronaldoussoren/py2app/issue/33/py2app-should-clean-environment-better>) to ensure that I won't forget fixing this in a future release of py2app. Ronald > > -- robert > |
From: Robert K. <rob...@gm...> - 2011-11-22 15:50:42
|
Ronald Oussoren <ron...@ma...> wrote on Tue Nov 22 2011 at 16:44:55: > > What happens when you add "os.delenv('PYOBJC_BUNDLE_ADDRESS')" before you try to open the bundle? Great, that solves the problem! -- robert |
From: Ronald O. <ron...@ma...> - 2011-11-22 15:44:26
|
On 21 Nov, 2011, at 7:08, Robert Klep wrote: > Hey all, > > I'm running into a strange problem with PyObjC-based apps. > > The situation: I'm working on a .mailbundle (a plug-in for Apple Mail). From that plug-in, I want to start a PyObjC-based application. No matter what, this fails: the application gets a SIGSEGV (I'll post some more information below). > > I've used pretty much all methods of starting the application (NSWorkspace, NSTask, even executing "open -a APP" from the Python subprocess module), and it keeps failing. Of course, the app works without problems when started manually. Starting the app from a Python-shell using [NSWorkspace launchApplication:] works, too. Just not from within the plug-in. If I'd have to guess I'd say that py2app doesn't fully reset the environment and some bits of the environment that py2app sets to communicate with the bundle code leaks into application bundle and causes problems there. What happens when you add "os.delenv('PYOBJC_BUNDLE_ADDRESS')" before you try to open the bundle? Ronald |
From: Robert K. <rob...@gm...> - 2011-11-21 06:21:23
|
Hey all, I'm running into a strange problem with PyObjC-based apps. The situation: I'm working on a .mailbundle (a plug-in for Apple Mail). From that plug-in, I want to start a PyObjC-based application. No matter what, this fails: the application gets a SIGSEGV (I'll post some more information below). I've used pretty much all methods of starting the application (NSWorkspace, NSTask, even executing "open -a APP" from the Python subprocess module), and it keeps failing. Of course, the app works without problems when started manually. Starting the app from a Python-shell using [NSWorkspace launchApplication:] works, too. Just not from within the plug-in. Even the simplest 'app' fails: -snip- from Foundation import * class MyTestClass(NSObject): pass -snip- Same thing: SIGSEGV. Starting other apps (like Safari) isn't a problem, so it doesn't seem to be some sandbox-type blocking. Below is the relevant part of the crashlog. All I've been able to find out is that objc_msgSend_vtable3 is an Objective-C runtime shortcut for getting 'self'. It smells like a memory issue, but I'd be grateful if anyone could help me out. -snip- Process: App1 [797] Path: /Users/USER/*/App1.app/Contents/MacOS/App1 Identifier: name.klep.app1 Version: 0.0.0 (0.0.0) Code Type: X86-64 (Native) Parent Process: launchd [301] Date/Time: 2011-11-21 06:49:06.394 +0100 OS Version: Mac OS X 10.7.2 (11C74) Report Version: 9 Crashed Thread: 0 Dispatch queue: com.apple.main-thread Exception Type: EXC_BAD_ACCESS (SIGSEGV) Exception Codes: KERN_INVALID_ADDRESS at 0x00007fc2dac50c60 VM Regions Near 0x7fc2dac50c60: MALLOC_TINY 0000000104e00000-0000000104f00000 [ 1024K] rw-/rwx SM=PRV --> STACK GUARD 00007fff5bc00000-00007fff5f400000 [ 56.0M] ---/rwx SM=NUL stack guard for thread 0 Application Specific Information: objc_msgSend() selector name: self objc[797]: garbage collection is OFF Thread 0 Crashed:: Dispatch queue: com.apple.main-thread 0 libobjc.A.dylib 0x00007fff8c84c0cd objc_msgSend_vtable3 + 13 1 _objc.so 0x0000000101ba5a71 pythonify_c_value + 573 2 _objc.so 0x0000000101b9d92e 0x101b80000 + 121134 3 org.python.python 0x0000000101a87b58 PyEval_EvalFrameEx + 13318 4 org.python.python 0x0000000101a8acd8 PyEval_EvalCodeEx + 1996 5 org.python.python 0x0000000101a8ae6c PyEval_EvalCode + 341 6 org.python.python 0x0000000101a87e0a PyEval_EvalFrameEx + 14008 7 org.python.python 0x0000000101a8acd8 PyEval_EvalCodeEx + 1996 8 org.python.python 0x0000000101a28abf PyClassMethod_New + 1378 9 org.python.python 0x0000000101a07d32 PyObject_Call + 97 10 org.python.python 0x0000000101a83c40 PyEval_CallObjectWithKeywords + 180 11 _objc.so 0x0000000101ba0bd3 0x101b80000 + 134099 12 org.python.python 0x0000000101a4cafa PyType_Modified + 891 13 org.python.python 0x0000000101a07d32 PyObject_Call + 97 14 org.python.python 0x0000000101a07eed PyObject_CallFunctionObjArgs + 178 15 org.python.python 0x0000000101a8576b PyEval_EvalFrameEx + 4121 16 org.python.python 0x0000000101a8acd8 PyEval_EvalCodeEx + 1996 17 org.python.python 0x0000000101a8ad4d PyEval_EvalCode + 54 18 org.python.python 0x0000000101aa208f Py_CompileString + 62 19 org.python.python 0x0000000101aa214f PyRun_FileExFlags + 157 20 org.python.python 0x0000000101a801f6 _PyBuiltin_Init + 4630 21 org.python.python 0x0000000101a87d77 PyEval_EvalFrameEx + 13861 22 org.python.python 0x0000000101a8acd8 PyEval_EvalCodeEx + 1996 23 org.python.python 0x0000000101a8ae6c PyEval_EvalCode + 341 24 org.python.python 0x0000000101a87e0a PyEval_EvalFrameEx + 14008 25 org.python.python 0x0000000101a8acd8 PyEval_EvalCodeEx + 1996 26 org.python.python 0x0000000101a8ad4d PyEval_EvalCode + 54 27 org.python.python 0x0000000101aa208f Py_CompileString + 62 28 org.python.python 0x0000000101aa214f PyRun_FileExFlags + 157 29 org.python.python 0x0000000101aa32a2 PyRun_SimpleFileExFlags + 392 30 name.klep.app1 0x0000000100004476 start + 12854 31 name.klep.app1 0x0000000100004a96 main + 1465 32 name.klep.app1 0x0000000100001274 start + 52 -snip- -- robert |
From: Jair G. <jyr...@gm...> - 2011-11-12 00:58:30
|
Hi, I just installed and Lion in Snow Leopard xoode pyobjc runs in 4.1,which version should install Xcode? Thanks -- SIN ETIQUETAS.[ PUNTO ] http://flavors.me/jyr http://pythoncocoa.com http://opentumblr.com |
From: Lee T. <lee...@gm...> - 2011-11-11 00:52:14
|
Are there going to be any bindings implemented for this framework? Thanks |
From: Ronald O. <ron...@ma...> - 2011-08-31 07:06:15
|
On 28 Aug, 2011, at 17:31, Gordon Watson wrote: > Hi, > > Short version: Does there exsit a working version of PyObcC and AddressBook for Lion? > > Long version: ... > > I have been using the AddressBook 2.3 wrapper with Python 2.6.6, PyObjC v2.3 (all built using MacPorts) on OS X 10.6 Snow Leopard. After upgrading to OS X 10.7.1 Lion, although most of AddressBook seems to continue working, it no longer reads the postal address fields. That's odd, AFAIK nothing has changed in AddressBook in this respect. > > So, I tried reinstalling a fresh version (using MacPorts): Python 2.7.2, PyObjC v2.3 and AddressBook 2.3 > > I have tried Ronald Oussoren's latest work on bitbucket, but I haven't been able to figure out how to install it. Installing that copy won't help, the wrappers for AddressBook are the same as in 2.3. Installing from the repository is too hard at the moment, you need to run "python setup.py install" in a number of subdirectories and in the right order. Adding an install script is on my list, but that will have to wait until I have updated the metadata for Lion. That in turn is blocked on creating a proper parser for Objective-C, which is progressing slowly because I don't spent enough time on it. Ronald > > Thanks so much for any help. > > Gordon > ------------------------------------------------------------------------------ > EMC VNX: the world's simplest storage, starting under $10K > The only unified storage solution that offers unified management > Up to 160% more powerful than alternatives and 25% more efficient. > Guaranteed. http://p.sf.net/sfu/emc-vnx-dev2dev_______________________________________________ > Pyobjc-dev mailing list > Pyo...@li... > https://lists.sourceforge.net/lists/listinfo/pyobjc-dev |
From: Gordon W. <gor...@gm...> - 2011-08-28 15:31:11
|
Hi, Short version: Does there exsit a working version of PyObcC and AddressBook for Lion? Long version: ... I have been using the AddressBook 2.3 wrapper with Python 2.6.6, PyObjC v2.3 (all built using MacPorts) on OS X 10.6 Snow Leopard. After upgrading to OS X 10.7.1 Lion, although most of AddressBook seems to continue working, it no longer reads the postal address fields. So, I tried reinstalling a fresh version (using MacPorts): Python 2.7.2, PyObjC v2.3 and AddressBook 2.3 I have tried Ronald Oussoren's latest work on bitbucket, but I haven't been able to figure out how to install it. Thanks so much for any help. Gordon |
From: Ronald O. <ron...@ma...> - 2011-08-18 14:04:57
|
On 10 Aug, 2011, at 8:56, Jair Gaxiola wrote: > Hello, > > Try to translate the following code to PyObjC > (https://github.com/shpakovski/Popup/blob/master/Popup/MenubarController.m), > but I have a question about how to translate the line number 20 of the > selector > > _statusItemView.action = @ selector (togglePanel:); > > Does not work with > > statusItemView.action (selector (togglePanel)) _statusItemView.setAction_(b'togglePanel') Selectors are byte-strings (the 'b' prefix is only necessary when you use Python 3.x) Ronald > > Thanks > > -- > SIN ETIQUETAS.[ PUNTO ] > http://flavors.me/jyr > http://pythoncocoa.com > http://opentumblr.com > > ------------------------------------------------------------------------------ > uberSVN's rich system and user administration capabilities and model > configuration take the hassle out of deploying and managing Subversion and > the tools developers use with it. Learn more about uberSVN and get a free > download at: http://p.sf.net/sfu/wandisco-dev2dev > _______________________________________________ > Pyobjc-dev mailing list > Pyo...@li... > https://lists.sourceforge.net/lists/listinfo/pyobjc-dev |
From: Jair G. <jyr...@gm...> - 2011-08-10 06:57:08
|
Hello, Try to translate the following code to PyObjC (https://github.com/shpakovski/Popup/blob/master/Popup/MenubarController.m), but I have a question about how to translate the line number 20 of the selector _statusItemView.action = @ selector (togglePanel:); Does not work with statusItemView.action (selector (togglePanel)) Thanks -- SIN ETIQUETAS.[ PUNTO ] http://flavors.me/jyr http://pythoncocoa.com http://opentumblr.com |
From: SourceForge.net <no...@so...> - 2011-08-07 12:28:00
|
Bugs item #3387767, was opened at 2011-08-07 14:28 Message generated for change (Tracker Item Submitted) made by eaganjr You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=114534&aid=3387767&group_id=14534 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: None Group: None Status: Open Resolution: None Priority: 5 Private: No Submitted By: James Eagan (eaganjr) Assigned to: Nobody/Anonymous (nobody) Summary: NSLog raises exception on non-ascii text Initial Comment: It looks like the fix for bug ID 3085651 broke support for non-ascii (e.g., UTF8) strings for NSLog. [Using the standard system Python in 10.7.0] Frog:~ $ python Python 2.7.1 (r271:86832, Jun 16 2011, 16:59:05) [GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> from Foundation import * >>> NSLog(u'Foo') 2011-08-07 13:22:46.578 Python[9268:1507] Foo >>> NSLog(u'\xe9') Traceback (most recent call last): File "<stdin>", line 1, in <module> UnicodeEncodeError: 'ascii' codec can't encode character u'\xe9' in position 0: ordinal not in range(128) >>> For reference, here’s the same thing using the standard system Python in 10.6.7: Jagaroth:~ $ python Python 2.6.1 (r261:67515, Jun 24 2010, 21:47:49) [GCC 4.2.1 (Apple Inc. build 5646)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> from Foundation import * >>> NSLog(u'Foo') 2011-08-07 13:24:14.206 Python[44733:b07] Foo >>> NSLog(u'\xe9') 2011-08-07 13:24:27.737 Python[44733:b07] é >>> ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=114534&aid=3387767&group_id=14534 |
From: Ronald O. <ron...@ma...> - 2011-08-02 08:34:06
|
On 1 Aug, 2011, at 16:40, Ludovic Marcotte wrote: > Hello, > > Over the past few days, we've ported PyObjC (trunk) to GNUstep. It's known to compile and work on: > GCC Objective-C runtime < 4.6 > GCC Objective-C runtime >= 4.6 > GNUstep Objective-C runtime (libobjc-2-1.5). > To get this to work, you need GNUstep base and corebase from trunk. > > We've also integrated successfully PyObjC in the SOGo code (www.sogo.nu) - so it's now possible to fully extend SOGo's code using Python. > > Here is the patch - which could hopefully be included. The patch is a lot smaller than I'd expect given earlier attempts to port to GNUstep. I haven't reviewed the patch yet, but at first glance it looks clean enough. Given that the patch is a working port to GNUstep I'll likely commit this patch, possibly after some cleanup. Ronald |
From: Ludovic M. <lma...@in...> - 2011-08-01 14:41:03
|
Index: PyObjCTest/test_nsdate_proxy.py =================================================================== --- PyObjCTest/test_nsdate_proxy.py (revision 2606) +++ PyObjCTest/test_nsdate_proxy.py (working copy) @@ -7,6 +7,7 @@ # these have a custom proxy class. def testFormattingForDate(self): + return # This is jus a round-about way of testing that the right proxy # object is created formatter = NSDateFormatter.alloc().initWithDateFormat_allowNaturalLanguage_( @@ -22,6 +23,7 @@ def testFormattingForDateTime(self): + return # This is jus a round-about way of testing that the right proxy # object is created formatter = NSDateFormatter.alloc().initWithDateFormat_allowNaturalLanguage_( Index: PyObjCTest/test_number_proxy.py =================================================================== --- PyObjCTest/test_number_proxy.py (revision 2606) +++ PyObjCTest/test_number_proxy.py (working copy) @@ -11,7 +11,10 @@ import objc OC_PythonNumber = objc.lookUpClass("OC_PythonNumber") -NSCFNumber = objc.lookUpClass("NSCFNumber") +try: + NSCFNumber = objc.lookUpClass("NSCFNumber") +except objc.nosuchclass_error as msg: + NSCFNumber = objc.lookUpClass("NSNumber") NSOrderedAscending = -1 NSOrderedSame = 0 @@ -202,7 +205,10 @@ # The booleans True and False must be proxied as the corresponding # NSNumber constants, otherwise lowlevel Cocoa/CoreFoundation code # get's upset. - boolClass = objc.lookUpClass('NSCFBoolean') + try: + boolClass = objc.lookUpClass('NSCFBoolean') + except objc.nosuchclass_error as msg: + boolClass = objc.lookUpClass('NSNumber') for v in (True, False): self.assertIs(OC_TestNumber.numberClass_(v), boolClass) self.assertIs(objc.repythonify(v), v) Index: PyObjCTest/test_hidden_selector.py =================================================================== --- PyObjCTest/test_hidden_selector.py (revision 2606) +++ PyObjCTest/test_hidden_selector.py (working copy) @@ -57,6 +57,7 @@ def boolMethod(self): return 0 + boolMethod = objc.selector(boolMethod, signature=objc._C_NSBOOL + b'@:') class TestHiddenSelector (TestCase): def testHiddenInClassDef(self): Index: PyObjCTest/test_copying.py =================================================================== --- PyObjCTest/test_copying.py (revision 2606) +++ PyObjCTest/test_copying.py (working copy) @@ -242,7 +242,7 @@ a = NSMutableArray.arrayWithArray_(['a', 'b', 'c']) self.assertIsInstance(a, NSMutableArray) - b = copy.copy(a) + b = copy.mutableCopy(a) self.assertIsInstance(b, NSMutableArray) self.assertEqual(list(a), list(b)) Index: setup.py =================================================================== --- setup.py (revision 2606) +++ setup.py (working copy) @@ -25,6 +25,8 @@ # on 10.6 and running on an earlier release) USE_SYSTEM_LIBXML = False +USE_GNUSTEP = False + if sys.version_info < MIN_PYTHON: vstr = '.'.join(map(str, MIN_PYTHON)) raise SystemExit('PyObjC: Need at least Python ' + vstr) @@ -266,17 +268,45 @@ return packages, extensions return [], [] +CFLAGS=[ ] + # Double-check -if sys.platform != 'darwin': - print("You're not running on MacOS X, and don't use GNUstep") - print("I don't know how to build PyObjC on such a platform.") - print("Please read the ReadMe.") - print("") - raise SystemExit("ObjC runtime not found") +if sys.platform == 'darwin': + CFLAGS.extend([ + "-DMACOSX", + "-DPyObjC_BUILD_RELEASE=%02d%02d"%(tuple(map(int, platform.mac_ver()[0].split('.')[:2]))) + ]) + OBJC_LDFLAGS = frameworks('CoreFoundation', 'Foundation', 'Carbon') +else: + # Try to run the gnustep-config command to get build requirements on non-Mac platforms + # This is the version for a release build, uncomment the line below for debug builds + #GNUSTEP_CFLAGS = str(subprocess.Popen(["gnustep-config", "--objc-flags"], stdout=subprocess.PIPE).communicate()[0]).split() + GNUSTEP_CFLAGS = str(subprocess.Popen(["gnustep-config", "--debug-flags"], stdout=subprocess.PIPE).communicate()[0]).split() + if "" == GNUSTEP_CFLAGS: + print("You're not running on MacOS X, and don't use GNUstep") + print("I don't know how to build PyObjC on such a platform.") + print("Please read the ReadMe.") + print("") + raise SystemExit("ObjC runtime not found") + # Don't add the Mac OS X version to the release number, if we're not building on OS X + # FIXME: Do actually use something sensible instead + CFLAGS.extend([ + "-DPyObjC_BUILD_RELEASE=1" + ]) + CFLAGS.extend(GNUSTEP_CFLAGS) + #CFLAGS.extend(["-O0", "-g", "-fno-inline"]) + USE_GNUSTEP = True + # On non-Darwin platforms, we always want to use the system libraries. + USE_SYSTEM_FFI = True + USE_SYSTEM_LIBXML = True + # Load order is important here. Linking -corebase after -base causes a + # crash trying to register for a notification with a string that is not yet + # initialized. + OBJC_LDFLAGS = ["-lgnustep-corebase"] + OBJC_LDFLAGS.extend(str(subprocess.Popen(["gnustep-config", "--base-libs"], stdout=subprocess.PIPE).communicate()[0]).split()) from distutils.sysconfig import get_config_var -CFLAGS=[ ] # Enable 'PyObjC_STRICT_DEBUGGING' to enable some costly internal # assertions. @@ -288,14 +318,14 @@ # The following flags are an attempt at getting rid of /usr/local # in the compiler search path. "-DPyObjC_STRICT_DEBUGGING", - "-DMACOSX", # For libffi - "-DPyObjC_BUILD_RELEASE=%02d%02d"%(tuple(map(int, platform.mac_ver()[0].split('.')[:2]))), - "-no-cpp-precomp", - "-DMACOSX", +# "-no-cpp-precomp", +# Uncomment the line below for gcc >= 4.6. It has to be commented +# for gcc < 4.6 + "-D__OBJC2__=1" "-g", "-fexceptions", + "-fobjc-exceptions", - # Loads of warning flags "-Wall", "-Wstrict-prototypes", "-Wmissing-prototypes", "-Wformat=2", "-W", @@ -306,7 +336,6 @@ "-Wno-long-long", "-Wno-import", - "-DPyObjC_BUILD_RELEASE=%02d%02d"%(tuple(map(int, get_os_level().split('.')))), ]) ## Arghh, a stupid compiler flag can cause problems. Don't @@ -317,11 +346,9 @@ print ("Change -O0 to -O1") CFLAGS.append('-O1') -OBJC_LDFLAGS = frameworks('CoreFoundation', 'Foundation', 'Carbon') +#if not os.path.exists('/usr/include/objc/runtime.h'): + #CFLAGS.append('-DNO_OBJC2_RUNTIME') -if not os.path.exists('/usr/include/objc/runtime.h'): - CFLAGS.append('-DNO_OBJC2_RUNTIME') - # Force compilation with the local SDK, compilation of PyObC will result in # a binary that runs on other releases of the OS without using a particular SDK. CFLAGS.extend(['-isysroot', '/']) @@ -379,6 +406,7 @@ ExtensionList = [ Extension("objc._objc", list(glob.glob(os.path.join('Modules', 'objc', '*.m'))), + # FIXME: Use pkg_config to get flags for ffi extra_compile_args=CFLAGS + ["-I/usr/include/ffi"], extra_link_args=OBJC_LDFLAGS + ["-lffi"], depends=list(glob.glob(os.path.join('Modules', 'objc', '*.h'))), Index: Lib/PyObjCTools/TestSupport.py =================================================================== --- Lib/PyObjCTools/TestSupport.py (revision 2606) +++ Lib/PyObjCTools/TestSupport.py (working copy) @@ -85,6 +85,8 @@ global _os_release if _os_release is not None: return _os_release + # FIXME: This should do something sensible with GNUstep! + return '10.5' pl = _pl.readPlist('/System/Library/CoreServices/SystemVersion.plist') v = pl['ProductVersion'] Index: Modules/objc/OC_PythonData.m =================================================================== --- Modules/objc/OC_PythonData.m (revision 2606) +++ Modules/objc/OC_PythonData.m (working copy) @@ -1,6 +1,10 @@ #include "pyobjc.h" #import "OC_PythonData.h" +#ifndef NSUIntegerMax +# define NSUIntegerMax UINTPTR_MAX +#endif + @implementation OC_PythonData + dataWithPythonObject:(PyObject*)v; Index: Modules/objc/method-imp.m =================================================================== --- Modules/objc/method-imp.m (revision 2606) +++ Modules/objc/method-imp.m (working copy) @@ -1,4 +1,5 @@ #include "pyobjc.h" +#include "msg_send_compat.h" typedef struct { PyObject_HEAD @@ -379,7 +380,7 @@ } PyObjC_DURING - retval = (IMP)objc_msgSend(PyObjCClass_GetClass(self), + retval = objc_impMsgSendPtr(PyObjCClass_GetClass(self), PyObjCSelector_GetSelector(method), selector); PyObjC_HANDLER @@ -455,7 +456,7 @@ objc_superSetClass(super, object_getClass(objc_superGetReceiver(super))); PyObjC_DURING - retval = (IMP)objc_msgSendSuper(&super, + retval = objc_impMsgSendSuperPtr(&super, PyObjCSelector_GetSelector(method), selector); PyObjC_HANDLER Index: Modules/objc/closure_pool.m =================================================================== --- Modules/objc/closure_pool.m (revision 2606) +++ Modules/objc/closure_pool.m (working copy) @@ -12,6 +12,9 @@ static freelist* closure_freelist = NULL; +#ifndef PAGE_SIZE +# define PAGE_SIZE 4096 +#endif static freelist* allocate_block(void) { Index: Modules/objc/formal-protocol.m =================================================================== --- Modules/objc/formal-protocol.m (revision 2606) +++ Modules/objc/formal-protocol.m (working copy) @@ -9,14 +9,37 @@ */ #include "pyobjc.h" +#ifndef __APPLE__ +#if !(defined(__GNUSTEP_RUNTIME__) || defined(__GNU_LIBOBJC__)) +struct objc_method_description +{ + const char *name; + const char *types; +}; +#endif +struct objc_method_description_list +{ + int count; + struct objc_method_description list[0]; +}; +struct objc_protocol_list +{ + struct objc_protocol_list *next; + size_t count; + Protocol *list[1]; +}; +#endif + + /* * FIXME: Looking in the Protocol structure is a rather crude hack, especially with the Objective-C 2.0 * runtime API. Too bad there is no real API for doing what we want... */ struct Protocol_struct { -#ifndef __OBJC2__ +#if !defined(__OBJC2__) && defined(__APPLE__) @defs(Protocol); #else + id isa; char *protocol_name; struct objc_protocol_list *protocol_list; struct objc_method_description_list *instance_methods, *class_methods; Index: Modules/objc/objc-class.m =================================================================== --- Modules/objc/objc-class.m (revision 2606) +++ Modules/objc/objc-class.m (working copy) @@ -1801,6 +1801,7 @@ PyObject* PyObjCClass_ListProperties(PyObject* aClass) { +#if defined(__APPLE__) || defined(__GNUSTEP__RUNTME__) Class cls = Nil; Protocol* proto = nil; @@ -2003,6 +2004,7 @@ free(props); } Py_XDECREF(result); +#endif return NULL; } Index: Modules/objc/socketsupport.m =================================================================== --- Modules/objc/socketsupport.m (revision 2606) +++ Modules/objc/socketsupport.m (working copy) @@ -144,7 +144,9 @@ sinaddr = (struct sockaddr_in *)addr_ret; memset((void *) sinaddr, '\0', sizeof(*sinaddr)); sinaddr->sin_family = AF_INET; +#ifndef __linux__ sinaddr->sin_len = sizeof(*sinaddr); +#endif sinaddr->sin_addr.s_addr = INADDR_BROADCAST; return sizeof(sinaddr->sin_addr); } @@ -157,7 +159,9 @@ ((long) d1 << 24) | ((long) d2 << 16) | ((long) d3 << 8) | ((long) d4 << 0)); sinaddr->sin_family = AF_INET; +#ifndef __linux__ sinaddr->sin_len = sizeof(*sinaddr); +#endif return 4; } memset(&hints, 0, sizeof(hints)); Index: Modules/objc/OC_PythonDictionary.m =================================================================== --- Modules/objc/OC_PythonDictionary.m (revision 2606) +++ Modules/objc/OC_PythonDictionary.m (working copy) @@ -6,6 +6,10 @@ #include "pyobjc.h" #import "OC_PythonDictionary.h" +#ifndef NSUIntegerMax +# define NSUIntegerMax UINTPTR_MAX +#endif + static PyObject* mapTypes = NULL; /* Index: Modules/objc/fsref.h =================================================================== --- Modules/objc/fsref.h (revision 2606) +++ Modules/objc/fsref.h (working copy) @@ -4,8 +4,11 @@ #ifndef PyObjC_FSREF_H #define PyObjC_FSREF_H +#ifdef __APPLE__ #define IS_FSREF(typestr) \ (strncmp(typestr, @encode(FSRef), sizeof(@encode(FSRef))-1) == 0) +#else +#define IS_FSREF(x) 0 extern int PyObjC_encode_fsref(PyObject*, void*); extern PyObject* PyObjC_decode_fsref(void*); @@ -14,4 +17,7 @@ #define PyObjC_FSRefCheck(value) \ PyObject_TypeCheck(value, &PyObjC_FSRefType) + +#endif + #endif /* PyObjC_FSREF_H */ Index: Modules/objc/pyobjc-compat.h =================================================================== --- Modules/objc/pyobjc-compat.h (revision 2606) +++ Modules/objc/pyobjc-compat.h (working copy) @@ -46,18 +46,20 @@ #define unlikely(x) __builtin_expect (!!(x), 0) #define likely(x) __builtin_expect (!!(x), 1) #else +#define unlikely(x) x #define likely(x) x -#define likely(x) x #endif -#import <AvailabilityMacros.h> +#ifdef __APPLE__ +# import <AvailabilityMacros.h> /* On 10.1 there are no defines for the OS version. */ -#ifndef MAC_OS_X_VERSION_10_1 -#define MAC_OS_X_VERSION_10_1 1010 -#define MAC_OS_X_VERSION_MAX_ALLOWED MAC_OS_X_VERSION_10_1 +# ifndef MAC_OS_X_VERSION_10_1 +# define MAC_OS_X_VERSION_10_1 1010 +# define MAC_OS_X_VERSION_MAX_ALLOWED MAC_OS_X_VERSION_10_1 -#error "MAC_OS_X_VERSION_10_1 not defined. You aren't running 10.1 are you?" +# error "MAC_OS_X_VERSION_10_1 not defined. You aren't running 10.1 are you?" +# endif #endif @@ -151,7 +153,7 @@ #define PyErr_Format PyObjCErr_Format -extern PyObject* PyObjCErr_Format(PyObject* exception, const char* format, ...); +PyObject* PyObjCErr_Format(PyObject* exception, const char* format, ...); #define PyText_Check PyString_Check #define PyText_FromFormat PyString_FromFormat Index: Modules/objc/fsref.m =================================================================== --- Modules/objc/fsref.m (revision 2606) +++ Modules/objc/fsref.m (working copy) @@ -2,6 +2,7 @@ * A custom wrapper for the (opaque) FSRef structure. */ #include "pyobjc.h" +#ifdef __APPLE__ #import <CoreServices/CoreServices.h> @@ -239,3 +240,4 @@ result->ref = *(FSRef*)buffer; return (PyObject*)result; } +#endif Index: Modules/objc/ObjCPointer.m =================================================================== --- Modules/objc/ObjCPointer.m (revision 2606) +++ Modules/objc/ObjCPointer.m (working copy) @@ -138,8 +138,6 @@ const char *typeend = PyObjCRT_SkipTypeSpec (t); PyObjCPointer *self; - NSLog(@"PyObjCPointer created: at %p of type %s", p, t); - if (size == -1) { return NULL; } Index: Modules/objc/module.m =================================================================== --- Modules/objc/module.m (revision 2606) +++ Modules/objc/module.m (working copy) @@ -4,9 +4,21 @@ */ #include "pyobjc.h" #include "OC_NSBundleHack.h" -#include <objc/Protocol.h> +#import <objc/Protocol.h> +#ifdef __APPLE__ #include <objc/objc-sync.h> +#else +// GNU runtimes do not expose ABI functions in headers. +int objc_sync_enter(id obj); +int objc_sync_exit(id obj); +enum +{ + OBJC_SYNC_SUCCESS = 0 +}; +#endif + + #include <stddef.h> #include <ctype.h> #include <sys/socket.h> @@ -17,9 +29,11 @@ #import <Foundation/NSProcessInfo.h> #import <Foundation/NSString.h> +#ifdef __APPLE__ #import <mach-o/dyld.h> #import <mach-o/getsect.h> #import <mach-o/loader.h> +#endif #import <objc/Protocol.h> int PyObjC_VerboseLevel = 0; @@ -2049,12 +2063,14 @@ if (PyType_Ready(&PyObjC_VarList_Type) < 0) { PyObjC_INITERROR(); } +#ifdef __APPLE__ if (PyType_Ready(&PyObjC_FSRefType) < 0) { PyObjC_INITERROR(); } if (PyType_Ready(&PyObjC_FSSpecType) < 0) { PyObjC_INITERROR(); } +#endif PyObjCSuper_Type.tp_doc = PySuper_Type.tp_doc; PyObjCSuper_Type.tp_init = PySuper_Type.tp_init; @@ -2098,12 +2114,14 @@ if (PyDict_SetItemString(d, "selector", (PyObject*)&PyObjCSelector_Type) < 0) { PyObjC_INITERROR(); } +#ifdef __APPLE__ if (PyDict_SetItemString(d, "FSRef", (PyObject*)&PyObjC_FSRefType) < 0) { PyObjC_INITERROR(); } if (PyDict_SetItemString(d, "FSSpec", (PyObject*)&PyObjC_FSSpecType) < 0) { PyObjC_INITERROR(); } +#endif if (PyDict_SetItemString(d, "ivar", (PyObject*)&PyObjCInstanceVariable_Type) < 0) { PyObjC_INITERROR(); } Index: Modules/objc/libffi_support.m =================================================================== --- Modules/objc/libffi_support.m (revision 2606) +++ Modules/objc/libffi_support.m (working copy) @@ -20,7 +20,7 @@ #ifdef __ppc64__ extern bool ffi64_stret_needs_ptr(const ffi_type* inType, unsigned short*, unsigned short*); -#endif; +#endif /* * Define SMALL_STRUCT_LIMIT as the largest struct that will be returned @@ -30,7 +30,7 @@ static const char gCharEncoding[] = { _C_CHR, 0 }; static const char gCFRangeEncoding[1024] = { 0 }; -#if defined(__ppc__) +#if defined(__ppc__) || defined(PPC) # define SMALL_STRUCT_LIMIT 4 @@ -3796,6 +3796,7 @@ } useStret = 0; +#ifdef __APPLE__ if (*rettype == _C_STRUCT_B && #ifdef __ppc64__ ffi64_stret_needs_ptr(signature_to_ffi_return_type(rettype), NULL, NULL) @@ -3824,6 +3825,7 @@ useStret = 1; } +#endif superPtr = &super; arglist[ 0] = &ffi_type_pointer; values[ 0] = &superPtr; @@ -3868,6 +3870,7 @@ msgResult, values); } else { +#ifdef __APPLE__ if (useStret) { ffi_call(&cif, FFI_FN(objc_msgSendSuper_stret), msgResult, values); @@ -3876,6 +3879,13 @@ msgResult, values); } +#else + // GNU runtimes do not provide message sending trampolines, so we + // must look up the IMP and then call it directly. + IMP method = objc_msg_lookup_super(superPtr, theSel); + values[0] = &self_obj; + ffi_call(&cif, FFI_FN(method), msgResult, values); +#endif } PyObjC_HANDLER Index: Modules/objc/pyobjc-api.h =================================================================== --- Modules/objc/pyobjc-api.h (revision 2606) +++ Modules/objc/pyobjc-api.h (working copy) @@ -120,7 +120,7 @@ -#include <objc/objc-runtime.h> +#include <objc/objc.h> /* On 10.1 there are no defines for the OS version. */ #ifndef MAC_OS_X_VERSION_10_1 Index: Modules/objc/class-builder.m =================================================================== --- Modules/objc/class-builder.m (revision 2606) +++ Modules/objc/class-builder.m (working copy) @@ -5,6 +5,7 @@ #include "pyobjc.h" #import <Foundation/NSInvocation.h> +#include "msg_send_compat.h" PyObject* PyObjC_class_setup_hook = NULL; @@ -1361,7 +1362,7 @@ "c@::", object_method_respondsToSelector); -#if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_4 +#if !defined(GNUSTEP) && (MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_4) if (_KVOHackLevel() == BROKEN_KVO) { METH( "willChangeValueForKey_", @@ -1458,13 +1459,17 @@ Method meth; int is_override = 0; IMP imp; + const char *signature = PyObjCSelector_GetNativeSignature(value); meth = class_getInstanceMethod(super_class, PyObjCSelector_GetSelector(value)); if (meth) { is_override = 1; + signature = method_getTypeEncoding(meth); if (!same_signature(method_getTypeEncoding(meth), PyObjCSelector_GetNativeSignature(value))) { + NSLog(@"Method encoding is: %s", method_getTypeEncoding(meth)); + NSLog(@"Selector encoding is: %s", PyObjCSelector_GetNativeSignature(value)); PyErr_Format(PyObjCExc_BadPrototypeError, "%R has signature that is not compatible with super-class", @@ -1482,7 +1487,7 @@ } if (!preclass_addMethod(new_class, PyObjCSelector_GetSelector(value), imp, - PyObjCSelector_GetNativeSignature(value))) { + signature)) { goto error_cleanup; } } @@ -1498,15 +1503,20 @@ Method meth; int is_override = 0; IMP imp; + const char *signature = PyObjCSelector_GetNativeSignature(value); meth = class_getClassMethod(super_class, PyObjCSelector_GetSelector(value)); if (meth) { is_override = 1; + signature = method_getTypeEncoding(meth); + if (!same_signature(method_getTypeEncoding(meth), PyObjCSelector_GetNativeSignature(value))) { + NSLog(@"Method encoding is: %s", method_getTypeEncoding(meth)); + NSLog(@"Selector encoding is: %s", PyObjCSelector_GetNativeSignature(value)); PyErr_Format(PyObjCExc_BadPrototypeError, "%R has signature that is not compatible with super-class", value); @@ -1537,6 +1547,13 @@ Py_XDECREF(instance_variables); instance_variables = NULL; Py_XDECREF(instance_methods); instance_methods = NULL; Py_XDECREF(class_methods); class_methods = NULL; +#ifdef __GNU_LIBOBJC__ + // The GCC runtime is broken. We are forced to register the class now, or + // subsequent calls to class_getSuperclass() will return Nil instead of the + // superclass. +#warning Enabling hacks to work around bugs in the GCC Objective-C runtime. A better solution is to migrate to the GNUstep Objective-C runtime. + objc_registerClassPair(new_class); +#endif /* * NOTE: Class is not registered yet, we do that as lately as possible @@ -1789,7 +1806,7 @@ objc_superSetClass(spr, (Class)userdata); objc_superSetReceiver(spr, self); - copy = objc_msgSendSuper(&spr, _meth, zone); + copy = objc_msgSendSuperPtr(&spr, _meth, zone); if (copy == nil) { *(id*)resp = nil; @@ -1884,7 +1901,7 @@ objc_superSetClass(spr, (Class)userdata); objc_superSetReceiver(spr, self); - *pres = ((int(*)(struct objc_super*, SEL, SEL))objc_msgSendSuper)(&spr, _meth, aSelector); + *pres = objc_intMsgSendSuperPtr(&spr, _meth, aSelector); return; } @@ -1911,7 +1928,7 @@ objc_superSetReceiver(spr, self); NS_DURING - *presult = objc_msgSendSuper(&spr, _meth, aSelector); + *presult = objc_msgSendSuperPtr(&spr, _meth, aSelector); NS_HANDLER *presult = nil; NS_ENDHANDLER @@ -2020,7 +2037,7 @@ objc_superSetClass(spr, (Class)userdata); objc_superSetReceiver(spr, self); PyGILState_Release(state); - objc_msgSendSuper(&spr, _meth, invocation); + objc_msgSendSuperPtr(&spr, _meth, invocation); return; } @@ -2396,7 +2413,7 @@ NS_DURING objc_superSetClass(spr, (Class)userdata); objc_superSetReceiver(spr, self); - *((id *)retval) = (id)objc_msgSendSuper(&spr, _meth, key); + *((id *)retval) = objc_msgSendSuperPtr(&spr, _meth, key); NS_HANDLER /* Parent doesn't know the key, try to create in the @@ -2470,13 +2487,13 @@ if (_UseKVO(self, key, isSet)) { objc_superSetClass(spr, (Class)userdata); objc_superSetReceiver(spr, self); - (void)objc_msgSendSuper(&spr, _meth, key); + (void)objc_msgSendSuperPtr(&spr, _meth, key); } #else objc_superSetClass(spr, (Class)userdata); objc_superSetReceiver(spr, self); - (void)objc_msgSendSuper(&spr, _meth, key); + (void)objc_msgSendSuperPtr(&spr, _meth, key); #endif } @@ -2516,7 +2533,7 @@ // First check super objc_superSetClass(spr, (Class)userdata); objc_superSetReceiver(spr, self); - (void)objc_msgSendSuper(&spr, _meth, value, key); + (void)objc_msgSendSuperPtrPtr(&spr, _meth, value, key); NS_HANDLER /* Parent doesn't know the key, try to create in the * python side, just like for plain python objects. Index: Modules/objc/parsexml.m =================================================================== --- Modules/objc/parsexml.m (revision 2606) +++ Modules/objc/parsexml.m (working copy) @@ -10,7 +10,11 @@ #include "pyobjc.h" #include <dlfcn.h> +#ifndef RTLD_DEFAULT +# define RTLD_DEFAULT ((void*)0) +#endif + /* Use the libxml2 parser */ /* XXX: these are needed to avoid problems when using the system version Index: Modules/objc/coder-category.m =================================================================== --- Modules/objc/coder-category.m (revision 2606) +++ Modules/objc/coder-category.m (working copy) @@ -7,6 +7,7 @@ * to avoid creating circular dependencies. */ #import <Foundation/Foundation.h> +#include <stdbool.h> @implementation NSCoder (pyobjc) Index: Modules/objc/OC_PythonUnicode.m =================================================================== --- Modules/objc/OC_PythonUnicode.m (revision 2606) +++ Modules/objc/OC_PythonUnicode.m (working copy) @@ -157,11 +157,8 @@ length:(NSUInteger)length freeWhenDone:(BOOL)flag { -#ifndef PyObjC_UNICODE_FAST_PATH -# error "Wide UNICODE builds are not supported at the moment" -#endif PyObjC_BEGIN_WITH_GIL - value = PyUnicode_FromUnicode((Py_UNICODE*)characters, length); + value = PyUnicode_DecodeUTF16((const char*)characters, length, NULL, 0); if (value == NULL) { PyObjC_GIL_FORWARD_EXC(); } @@ -176,7 +173,9 @@ -initWithBytes:(void*)bytes length:(NSUInteger)length encoding:(NSStringEncoding)encoding { #ifndef PyObjC_UNICODE_FAST_PATH -# error "Wide UNICODE builds are not supported at the moment" +#warning "Wide UNICODE builds are not supported at the moment" + [NSException raise: @"NSNotImplementedException" + format: @"[%@ %@] not supported]", [self class], NSStringFromSelector(_cmd)]; #endif NSString* tmpval = [[NSString alloc] initWithBytes:bytes length:length encoding:encoding]; Py_ssize_t charcount = [tmpval length]; Index: Modules/objc/objc_support.m =================================================================== --- Modules/objc/objc_support.m (revision 2606) +++ Modules/objc/objc_support.m (working copy) @@ -16,7 +16,7 @@ */ #include "pyobjc.h" -#include <objc/Protocol.h> +#import <objc/Protocol.h> #include <unistd.h> #include <sys/socket.h> Index: Modules/objc/corefoundation.h =================================================================== --- Modules/objc/corefoundation.h (revision 2606) +++ Modules/objc/corefoundation.h (working copy) @@ -1,6 +1,8 @@ #ifndef PyObjC_COREFOUNDATION_H #define PyObjC_COREFOUNDATION_H +#include <CoreFoundation/CoreFoundation.h> + extern PyObject* PyObjC_NSCFTypeClass; extern int PyObjCCFType_Setup(void); Index: Modules/objc/objc-runtime-compat.h =================================================================== --- Modules/objc/objc-runtime-compat.h (revision 2606) +++ Modules/objc/objc-runtime-compat.h (working copy) @@ -22,7 +22,14 @@ * the preclass_* functions, not the regular ones because it isn't possible * to emulate the entire ObjC 2.0 API on Tiger. */ -#include <objc/objc-runtime.h> +#ifdef GNUSTEP +# ifndef __strong +# define __strong +# endif +# include <stdbool.h> +#else +# include <objc/runtime.h> +#endif #include <objc/Protocol.h> #define _C_CONST 'r' @@ -70,7 +77,7 @@ BOOL PyObjC_class_isSubclassOf(Class child, Class parent); #define class_isSubclassOf PyObjC_class_isSubclassOf -#if (MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5) && !defined(__OBJC2__) +#if (MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5) && !defined(__OBJC2__) && defined(__APPLE__) #define preclass_addIvar PyObjC_preclass_addIvar #define preclass_addMethod PyObjC_preclass_addMethod Index: Modules/objc/fsspec.h =================================================================== --- Modules/objc/fsspec.h (revision 2606) +++ Modules/objc/fsspec.h (working copy) @@ -4,9 +4,14 @@ #ifndef PyObjC_FSSPEC_H #define PyObjC_FSSPEC_H +#ifdef __APPLE__ #define IS_FSSPEC(typestr) \ (strncmp(typestr, @encode(FSSpec), sizeof(@encode(FSSpec))-1) == 0) +#else +#define IS_FSSPEC(typestr) 0 +#endif + extern int PyObjC_encode_fsspec(PyObject*, void*); extern PyObject* PyObjC_decode_fsspec(void*); Index: Modules/objc/objc-runtime-compat.m =================================================================== --- Modules/objc/objc-runtime-compat.m (revision 2606) +++ Modules/objc/objc-runtime-compat.m (working copy) @@ -11,7 +11,7 @@ -#if (MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5) &&!defined(__OBJC2__) +#if (MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5) &&!defined(__OBJC2__) && defined(__APPLE__) BOOL PyObjC_class_isSubclassOf(Class child, Class parent) { Index: Modules/objc/selector.m =================================================================== --- Modules/objc/selector.m (revision 2606) +++ Modules/objc/selector.m (working copy) @@ -799,7 +799,7 @@ } if (Object_class == nil) { - Object_class = [Object class]; + Object_class = NSClassFromString(@"Object"); } if (name[0] == '_' && name[1] == '_') { @@ -956,6 +956,7 @@ result->sel_selector = selector; result->sel_python_signature = signature; result->sel_native_signature = PyObjCUtil_Strdup(signature); + if (result->sel_native_signature == NULL) { Py_DECREF(result); return NULL; Index: Modules/objc/fsspec.m =================================================================== --- Modules/objc/fsspec.m (revision 2606) +++ Modules/objc/fsspec.m (working copy) @@ -1,6 +1,7 @@ /* * A custom wrapper for the (opaque) FSSpec structure. */ +#ifdef __APPLE__ #include "pyobjc.h" #import <CoreServices/CoreServices.h> @@ -168,3 +169,5 @@ result->ref = *(FSSpec*)buffer; return (PyObject*)result; } + +#endif // __APPLE__ Index: Modules/objc/test/locking.m =================================================================== --- Modules/objc/test/locking.m (revision 2606) +++ Modules/objc/test/locking.m (working copy) @@ -24,6 +24,7 @@ -(void)threadFunc:(NSObject*)object { int i; + id pool = [NSAutoreleasePool new]; for (i = 0; i < 6; i++) { usleep(500000); @synchronized(object) { @@ -38,6 +39,7 @@ [object setLocked:[NSNumber numberWithBool:NO]]; } } + [pool drain]; } @end Index: Modules/objc/test/testbndl2.m =================================================================== --- Modules/objc/test/testbndl2.m (revision 2606) +++ Modules/objc/test/testbndl2.m (working copy) @@ -12,6 +12,7 @@ #import "Python.h" #import "pyobjc-api.h" #import <limits.h> +#import <stdbool.h> #import <Foundation/Foundation.h> Index: Modules/objc/test/corefoundation.m =================================================================== --- Modules/objc/test/corefoundation.m (revision 2606) +++ Modules/objc/test/corefoundation.m (working copy) @@ -4,6 +4,7 @@ * XXX: add a second type that isn't tollfree bridged to check that the * default behaviour works as well. */ +#ifdef __APPLE__ #include "Python.h" #include "pyobjc-api.h" @@ -178,3 +179,5 @@ INITDONE(); } + +#endif // __APPLE__ Index: Modules/objc/test/specialtypecodes.m =================================================================== --- Modules/objc/test/specialtypecodes.m (revision 2606) +++ Modules/objc/test/specialtypecodes.m (working copy) @@ -7,6 +7,8 @@ #import <Foundation/Foundation.h> +#define UniChar unichar + #ifndef NSINTEGER_DEFINED typedef unsigned int NSUInteger; Index: Modules/objc/test/cfsocket.m =================================================================== --- Modules/objc/test/cfsocket.m (revision 2606) +++ Modules/objc/test/cfsocket.m (working copy) @@ -1,6 +1,7 @@ /* * This module is used in the unittests for object identity. */ +#ifdef __APPLE__ #include "Python.h" #include "pyobjc-api.h" @@ -80,3 +81,4 @@ INITDONE(); } +#endif Index: Modules/objc/test/fsref.m =================================================================== --- Modules/objc/test/fsref.m (revision 2606) +++ Modules/objc/test/fsref.m (working copy) @@ -1,6 +1,7 @@ /* * This module is used for tests dealing with FSRef "objects" */ +#ifdef __APPLE__ #include "Python.h" #include "pyobjc-api.h" @@ -128,3 +129,4 @@ INITDONE(); } +#endif Index: Modules/objc/test/ctests.m =================================================================== --- Modules/objc/test/ctests.m (revision 2606) +++ Modules/objc/test/ctests.m (working copy) @@ -6,6 +6,7 @@ */ #include "pyobjc-api.h" #include "pyobjc-compat.h" +#include <stdbool.h> #if PY_VERSION_HEX >= 0x03000000 #define PyInt_AsLong PyLong_AsLong Index: Modules/objc/OC_PythonString.m =================================================================== --- Modules/objc/OC_PythonString.m (revision 2606) +++ Modules/objc/OC_PythonString.m (working copy) @@ -133,7 +133,8 @@ freeWhenDone:(BOOL)flag { #ifndef PyObjC_UNICODE_FAST_PATH -# error "Wide UNICODE builds are not supported at the moment" +# warning "Wide UNICODE builds are not supported at the moment" + [self doesNotRecognize: _cmd]; #endif PyObjC_BEGIN_WITH_GIL PyObject* v; Index: Modules/objc/pointer-support.m =================================================================== --- Modules/objc/pointer-support.m (revision 2606) +++ Modules/objc/pointer-support.m (working copy) @@ -344,6 +344,7 @@ { int r = 0; +#ifdef __APPLE__ r = PyObjCPointerWrapper_RegisterCF(@encode(CFURLRef)); if (r == -1) return -1; @@ -360,6 +361,7 @@ r = PyObjCPointerWrapper_RegisterCF(@encode(CFRunLoopRef)); if (r == -1) return -1; +#endif // __APPLE__ r = PyObjCPointerWrapper_Register(@encode(PyObject*), PyObjectPtr_New, PyObjectPtr_Convert); Index: Modules/objc/objc_util.m =================================================================== --- Modules/objc/objc_util.m (revision 2606) +++ Modules/objc/objc_util.m (working copy) @@ -1027,7 +1027,8 @@ #if defined(PyObjC_UNICODE_FAST_PATH) result = PyUnicode_FromUnicode((Py_UNICODE*)array, size); #else -# error "Sorry, Wide Unicode builds not supported at the moment" +# warning "Sorry, Wide Unicode builds not supported at the moment" + abort(); #endif return result; } @@ -1143,7 +1144,11 @@ #if defined(PyObjC_UNICODE_FAST_PATH) result = PyUnicode_FromUnicode((Py_UNICODE*)array, size); #else -# error "Sorry, Wide Unicode builds not supported at the moment" +# warning "Sorry, Wide Unicode builds not supported at the moment" + // This is a quick hack so that we just fail tests, we don't abort when + // we get to them. + return Py_None; + abort(); #endif return result; } Index: Modules/objc/OC_PythonNumber.m =================================================================== --- Modules/objc/OC_PythonNumber.m (revision 2606) +++ Modules/objc/OC_PythonNumber.m (working copy) @@ -13,8 +13,11 @@ - initWithPythonObject:(PyObject*)v; { + // NSNumber's -init destroys self on GNUstep. This is fixed in trunk. +#ifndef GNUSTEP self = [super init]; if (unlikely(self == nil)) return nil; +#endif Py_INCREF(v); Py_XDECREF(value); Index: Modules/objc/alloc_hack.m =================================================================== --- Modules/objc/alloc_hack.m (revision 2606) +++ Modules/objc/alloc_hack.m (working copy) @@ -2,6 +2,7 @@ * alloc_hack.m -- Implementation of alloc_hack.h */ #include "pyobjc.h" +#include "msg_send_compat.h" static PyObject* call_NSObject_alloc(PyObject* method, Index: Modules/objc/pyobjc.h =================================================================== --- Modules/objc/pyobjc.h (revision 2606) +++ Modules/objc/pyobjc.h (working copy) @@ -1,6 +1,13 @@ +#include <stdbool.h> + +#ifndef __strong +# define __strong +#endif + #ifndef PyObjC_H #define PyObjC_H + /* * Central include file for PyObjC. */ @@ -12,6 +19,62 @@ #define PYOBJC_EXPECTED_CLASS_COUNT 3000 #define PY_SSIZE_T_CLEAN +#ifdef GNUSTEP +# ifdef __OBJC2__ +# include <objc/runtime.h> +#if (defined(__GNU_LIBOBJC__) && (__GNU_LIBOBJC__ >= 20100911)) +struct objc_super + { + id receiver; + Class super_class; + }; +#endif +# else +# import <ObjectiveC2/runtime.h> +# define __objc_INCLUDE_GNU +# define __objc_api_INCLUDE_GNU +# define __object_INCLUDE_GNU +# define __encoding_INCLUDE_GNU +# undef objc_msgSendSuper +# undef objc_msgSend +@interface Object { Class isa; } @end +typedef void* arglist_t; +#define _C_ID '@' +#define _C_CLASS '#' +#define _C_SEL ':' +#define _C_CHR 'c' +#define _C_UCHR 'C' +#define _C_SHT 's' +#define _C_USHT 'S' +#define _C_INT 'i' +#define _C_UINT 'I' +#define _C_LNG 'l' +#define _C_ULNG 'L' +#define _C_LNG_LNG 'q' +#define _C_ULNG_LNG 'Q' +#define _C_FLT 'f' +#define _C_DBL 'd' +#define _C_BFLD 'b' +#define _C_BOOL 'B' +#define _C_VOID 'v' +#define _C_UNDEF '?' +#define _C_PTR '^' +#define _C_CHARPTR '*' +#define _C_ATOM '%' +#define _C_ARY_B '[' +#define _C_ARY_E ']' +#define _C_UNION_B '(' +#define _C_UNION_E ')' +#define _C_STRUCT_B '{' +#define _C_STRUCT_E '}' +#define _C_VECTOR '!' +#define _C_COMPLEX 'j' +# endif +#else +# include <objc/objc-runtime.h> +# include <objc/objc.h> +#endif + #include <Python.h> #include "structmember.h" #include "pyobjc-compat.h" @@ -26,14 +89,11 @@ #define PyObjC_ERROR_ABORT 1 -#include <objc/objc-runtime.h> -#include <objc/objc.h> - // how do we make this dependent on sizeof(unichar)?? #if Py_UNICODE_SIZE == 2 #define PyObjC_UNICODE_FAST_PATH #else -#error "Py_UNICODE_SIZE != 2 is not supported" +//#error "Py_UNICODE_SIZE != 2 is not supported" #endif #include "objc-runtime-compat.h" |
From: Ronald O. <ron...@ma...> - 2011-07-24 15:47:58
|
On 22 Jul, 2011, at 9:13, Greg Ewing wrote: > I found out what was causing this. Turns out it was blocked > importing encodings.ascii, trying to acquire the import lock. > > The reason it couldn't acquire the import lock is that the > main module of my application was a stub that imported the > real main module, which in turn started the event loop > directly from the module code. > > So the whole app was running inside an import statement, > holding on to the import lock. Once I fixed that, everything > was fine. Ouch. That can be a hard one to debug. Thank you for reporting back on the cause of your problem, Ronald > > -- > Greg > > > ------------------------------------------------------------------------------ > 10 Tips for Better Web Security > Learn 10 ways to better secure your business today. Topics covered include: > Web security, SSL, hacker attacks & Denial of Service (DoS), private keys, > security Microsoft Exchange, secure Instant Messaging, and much more. > http://www.accelacomm.com/jaw/sfnl/114/51426210/ > _______________________________________________ > Pyobjc-dev mailing list > Pyo...@li... > https://lists.sourceforge.net/lists/listinfo/pyobjc-dev |