[Pythonmac-SIG] strange behavior with NSArray and python unicode types

Ronald Oussoren ronaldoussoren at mac.com
Sun Aug 14 12:08:07 CEST 2005


On 13-aug-2005, at 10:52, Jon Rosebaugh wrote:

> On 8/13/05, Bob Ippolito <bob at redivi.com> wrote:
>
>>
>> That shouldn't happen, I doubt that it's actually the situation you
>> describe.  Post something reproducible and someone will look at it.
>>
>
> You're right, it wasn't the problem; I'm kinda ashamed that I didn't
> notice it now, because the self.Name was a unicode string too, and it
> worked fine. Turns out that self.Data was a objc.pyobjc_unicode
> object, since it had gone through the bridge and back. Sorry to
> trouble you.

That still sounds fishy. If I understand you correctly you have a  
pyobjc_unicode object that is not an empty string (that is  
"theString != ''"), but is an empty string when converted back to  
Objective-C. Could you elaborate on what you're doing? Unless the  
Objective-C strings is an NSMutableString and someone is mutating it  
behind your back the value in python should be the same as the value  
in ObjC.

BTW. str(self.Data) is very likely wrong when isinstance(self.Data,  
unicode), the former will raise an exception when the self.Data  
contains non-ASCII characters.

Ronald
> _______________________________________________
> Pythonmac-SIG maillist  -  Pythonmac-SIG at python.org
> http://mail.python.org/mailman/listinfo/pythonmac-sig
>



More information about the Pythonmac-SIG mailing list