Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

struni: Fix test_aepack by converting 4cc's to bytes #45247

Closed
jyasskin mannequin opened this issue Jul 26, 2007 · 5 comments
Closed

struni: Fix test_aepack by converting 4cc's to bytes #45247

jyasskin mannequin opened this issue Jul 26, 2007 · 5 comments
Assignees
Labels

Comments

@jyasskin
Copy link
Mannequin

jyasskin mannequin commented Jul 26, 2007

BPO 1761465
Nosy @gvanrossum
Files
  • aetypes_applesingle.diff: Fix to test_aepack and test_applesingle
  • aepack_b2i_to_str.diff
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = 'https://github.com/gvanrossum'
    closed_at = <Date 2008-01-06.22:29:45.788>
    created_at = <Date 2007-07-26.18:37:06.000>
    labels = ['OS-mac']
    title = "struni: Fix test_aepack by converting 4cc's to bytes"
    updated_at = <Date 2008-01-06.22:29:45.788>
    user = 'https://bugs.python.org/jyasskin'

    bugs.python.org fields:

    activity = <Date 2008-01-06.22:29:45.788>
    actor = 'admin'
    assignee = 'gvanrossum'
    closed = True
    closed_date = None
    closer = None
    components = ['macOS']
    creation = <Date 2007-07-26.18:37:06.000>
    creator = 'jyasskin'
    dependencies = []
    files = ['8135', '8136']
    hgrepos = []
    issue_num = 1761465
    keywords = ['patch']
    message_count = 5.0
    messages = ['52946', '52947', '52948', '52949', '52950']
    nosy_count = 2.0
    nosy_names = ['gvanrossum', 'jyasskin']
    pr_nums = []
    priority = 'normal'
    resolution = 'accepted'
    stage = None
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue1761465'
    versions = ['Python 3.0']

    @jyasskin
    Copy link
    Mannequin Author

    jyasskin mannequin commented Jul 26, 2007

    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.

    @jyasskin jyasskin mannequin closed this as completed Jul 26, 2007
    @jyasskin jyasskin mannequin assigned gvanrossum Jul 26, 2007
    @jyasskin jyasskin mannequin added OS-mac labels Jul 26, 2007
    @gvanrossum
    Copy link
    Member

    Committed revision 56560.

    (Except I changed the open mode from the unconventional 'bw' to 'wb'. :-)

    @jyasskin
    Copy link
    Mannequin Author

    jyasskin mannequin commented Jul 27, 2007

    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

    @gvanrossum
    Copy link
    Member

    Hmm... What if there's a 4CC containing a non-ASCII byte?

    @gvanrossum
    Copy link
    Member

    On the list we agreed not to apply the second patch.

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant