Navigation Menu

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

mmap, dbm, ossaudiodev, marshal & winreg return bytearray instead of bytes #48047

Closed
gpshead opened this issue Sep 6, 2008 · 8 comments
Closed
Assignees
Labels
deferred-blocker easy extension-modules C modules in the Modules dir type-bug An unexpected behavior, bug, or error

Comments

@gpshead
Copy link
Member

gpshead commented Sep 6, 2008

BPO 3797
Nosy @gpshead, @amauryfa, @pitrou
Files
  • mmap-dbm-oss_bytes.patch: PyByteArray -> PyBytes
  • marshal-winreg_bytes.patch: more PyByteArray -> PyBytes
  • 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/gpshead'
    closed_at = <Date 2008-09-06.21:35:20.256>
    created_at = <Date 2008-09-06.20:46:13.146>
    labels = ['extension-modules', 'easy', 'deferred-blocker', 'type-bug']
    title = 'mmap, dbm, ossaudiodev, marshal & winreg return bytearray instead of bytes'
    updated_at = <Date 2008-09-06.21:35:20.255>
    user = 'https://github.com/gpshead'

    bugs.python.org fields:

    activity = <Date 2008-09-06.21:35:20.255>
    actor = 'gregory.p.smith'
    assignee = 'gregory.p.smith'
    closed = True
    closed_date = <Date 2008-09-06.21:35:20.256>
    closer = 'gregory.p.smith'
    components = ['Extension Modules']
    creation = <Date 2008-09-06.20:46:13.146>
    creator = 'gregory.p.smith'
    dependencies = []
    files = ['11408', '11409']
    hgrepos = []
    issue_num = 3797
    keywords = ['patch', 'easy', 'needs review']
    message_count = 8.0
    messages = ['72691', '72693', '72696', '72698', '72699', '72700', '72701', '72706']
    nosy_count = 4.0
    nosy_names = ['gregory.p.smith', 'amaury.forgeotdarc', 'pitrou', 'ocean-city']
    pr_nums = []
    priority = 'deferred blocker'
    resolution = 'fixed'
    stage = None
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue3797'
    versions = ['Python 3.0']

    @gpshead
    Copy link
    Member Author

    gpshead commented Sep 6, 2008

    As noted in issue bpo-3492 the following py3k modules still erroneously
    return bytearray objects instead of bytes objects from their read functions:

    mmap
    dbm
    ossaudiodev

    Attached is a trivial patch to fix those.

    @gpshead gpshead self-assigned this Sep 6, 2008
    @gpshead gpshead added extension-modules C modules in the Modules dir easy type-bug An unexpected behavior, bug, or error labels Sep 6, 2008
    @gpshead
    Copy link
    Member Author

    gpshead commented Sep 6, 2008

    attached a patch for PC/winreg.c and Python/marshal.c.

    @gpshead gpshead changed the title mmap, dbm and ossaudiodev return bytearray instead of bytes mmap, dbm, ossaudiodev, marshal & winreg return bytearray instead of bytes Sep 6, 2008
    @ocean-city
    Copy link
    Mannequin

    ocean-city mannequin commented Sep 6, 2008

    Hello. I confirmed test_winreg.py passed after applied
    marshal-winreg_bytes.patch.

    @pitrou
    Copy link
    Member

    pitrou commented Sep 6, 2008

    Tests pass here as well, under Windows and Linux.

    @amauryfa
    Copy link
    Member

    amauryfa commented Sep 6, 2008

    • PyBytes_Resize takes a PyObject**, you should pass &rv. Didn't you get
      a compiler warning?

    • Here is an additional test for the winreg module, your patch is needed
      for it to pass.

    @pitrou
    Copy link
    Member

    pitrou commented Sep 6, 2008

    As for ossaudiodev:

    • PyByteArray_Resize(rv, count);
      + _PyBytes_Resize(rv, count);

    I think this should be _PyBytes_Resize(&rv, count) instead.

    @pitrou
    Copy link
    Member

    pitrou commented Sep 6, 2008

    Amaury beat me to the punch :-o

    @gpshead
    Copy link
    Member Author

    gpshead commented Sep 6, 2008

    heh indeed it should be &rv. i made the patch on a mac and hadn't run
    it on my linux host before opening the issue.

    fixed locally and given all of the reviews across all relevant
    platforms.. committing. py3k r66273.

    @gpshead gpshead closed this as completed Sep 6, 2008
    @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
    deferred-blocker easy extension-modules C modules in the Modules dir type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    3 participants