[Patches] [ python-Patches-1761465 ] struni: Fix test_aepack by converting 4cc's to bytes
SourceForge.net
noreply at sourceforge.net
Fri Jul 27 08:19:37 CEST 2007
Patches item #1761465, was opened at 2007-07-26 18:37
Message generated for change (Comment added) made by jyasskin
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1761465&group_id=5470
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: Macintosh
Group: Python 3000
Status: Closed
Resolution: Accepted
Priority: 5
Private: No
Submitted By: Jeffrey Yasskin (jyasskin)
Assigned to: Guido van Rossum (gvanrossum)
Summary: struni: Fix test_aepack by converting 4cc's to bytes
Initial Comment:
Also includes a simple fix for test_applesingle.
The core of this fix is to change Python/mactoolboxglue.c:PyMac_BuildOSType(OSType) to return a bytes object instead of a str8, and then to go through the python code and change the four-character-codes to bytes. This hits a snag when they're used as dictionary keys, since bytes isn't hashable, so a hacky little b2i() function converts them to ints first. b2i() should go away when someone writes the general bytes/int conversion api.
This is discussed some at http://mail.python.org/pipermail/python-3000/2007-July/008935.html. If Talin's and Ronald's preference from that thread is taken, then PyMac_BuildOSType should return their new type instead.
----------------------------------------------------------------------
>Comment By: Jeffrey Yasskin (jyasskin)
Date: 2007-07-27 06:19
Message:
Logged In: YES
user_id=581856
Originator: YES
But I like black'n'white files. ;)
I've attached a patch changing b2i to str for using 4CCs in dicts. Since
this file, at least, never needs to convert back, nothing's ambiguous about
it, and I do like the idea of being able to read these while debugging. The
test still passes.
File Added: aepack_b2i_to_str.diff
----------------------------------------------------------------------
Comment By: Guido van Rossum (gvanrossum)
Date: 2007-07-27 04:42
Message:
Logged In: YES
user_id=6380
Originator: NO
Committed revision 56560.
(Except I changed the open mode from the unconventional 'bw' to 'wb'. :-)
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1761465&group_id=5470
More information about the Patches
mailing list