[ pyobjc-Bugs-3077003 ] Misuse of strcmp() in -[OC_PythonString __realObject__]

"SourceForge.net" <[email protected]>
Newsgroups gmane.comp.python.pyobjc.devel
Message-ID <[email protected]>
Bugs item #3077003, was opened at 2010-09-28 01:39
Message generated for change (Tracker Item Submitted) made by kthomases
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=114534&aid=3077003&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: Ken Thomases (kthomases)
Assigned to: Nobody/Anonymous (nobody)
Summary: Misuse of strcmp() in -[OC_PythonString __realObject__]

Initial Comment:
Relatively recently, -[OC_PythonString __realObject__] was improved to try to use an encoding which matches the Python default encoding.  Unfortunately, it was done incorrectly.  It uses strcmp() as though it were a strequals() function, but the return value of strcmp() has the opposite logical sense.  It's 0 when the strings are equal and non-zero when they differ.  The result was that it uses UTF-8 when the Python encoding is "ascii" and ASCII otherwise.  (That's actually not a terrible result, since on Mac OS X UTF-8 is almost always the correct encoding to use, even though it's not Python's default encoding.)

Anyway, I'm attaching a patch to correct the logic.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=114534&aid=3077003&group_id=14534

------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.