Re: [Pyobjc-dev] threading
Brought to you by:
ronaldoussoren
From: Bob I. <bo...@re...> - 2005-03-30 19:46:15
|
On Mar 30, 2005, at 2:34 PM, Ronald Oussoren wrote: > > On 30-mrt-05, at 21:02, Bob Ippolito wrote: >> The *real* problem is that you're calling NSLog with str objects, not >> unicode objects, and it looks like it may be triggering some kind of >> GIL issue in PyObjC's type conversion stuff, which I'll look into >> later this week but... NEVER USE STR OBJECTS WHEN CROSSING THE >> BRIDGE. > <mumbles a bit> > > Be happy that he does use strings, this uncovered a bug in the bridge > ;-) > > The reason you shouldn't use str objects is internationalisation: your > strings are converted to unicode when the cross the bridge. This may > work for you now, but could suddenly fail when someone passes text > with accents into your program. Further more, because Python uses str to represent text *and* data, it makes life hard on PyObjC as Foundation has different classes to represent each. It is currently impossible to use a str type to represent data across the bridge, and it's not a good idea to use them to represent text. So, you shouldn't use them at all whenever humanly possible in the context of a PyObjC application. > According to gdb ThreadTest.py blocks in thread 2 because NSLog wants > to grab the GIL and in thread 1 because it also wants to fetch the GIL > somewhere in a function named 'inittime'. That's very odd, the > function name suggests the init function of the time extension, and > that shouldn't be called at this time. > > Debugging threading related bugs can be lots of fun ;-). > > I'm currently building python-2.4.1 with debugging hooks turned on, > that should make debugging slightly easier. Except for the fact that it will work using 2.4.1 ;) -bob |