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

Enhancement for mmap_read: Consistency with standard file read #60562

Closed
elwynd mannequin opened this issue Oct 29, 2012 · 1 comment
Closed

Enhancement for mmap_read: Consistency with standard file read #60562

elwynd mannequin opened this issue Oct 29, 2012 · 1 comment
Labels
stdlib Python modules in the Lib dir type-feature A feature request or enhancement

Comments

@elwynd
Copy link
Mannequin

elwynd mannequin commented Oct 29, 2012

BPO 16358
Nosy @jcea
Superseder
  • bpo-12021: mmap.read requires an argument
  • 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 = None
    closed_at = <Date 2012-10-29.16:31:15.323>
    created_at = <Date 2012-10-29.16:20:11.136>
    labels = ['type-feature', 'library']
    title = 'Enhancement for mmap_read: Consistency with standard file read'
    updated_at = <Date 2012-10-29.23:58:02.285>
    user = 'https://bugs.python.org/elwynd'

    bugs.python.org fields:

    activity = <Date 2012-10-29.23:58:02.285>
    actor = 'jcea'
    assignee = 'none'
    closed = True
    closed_date = <Date 2012-10-29.16:31:15.323>
    closer = 'r.david.murray'
    components = ['Library (Lib)']
    creation = <Date 2012-10-29.16:20:11.136>
    creator = 'elwynd'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 16358
    keywords = []
    message_count = 1.0
    messages = ['174123']
    nosy_count = 2.0
    nosy_names = ['jcea', 'elwynd']
    pr_nums = []
    priority = 'normal'
    resolution = 'duplicate'
    stage = 'resolved'
    status = 'closed'
    superseder = '12021'
    type = 'enhancement'
    url = 'https://bugs.python.org/issue16358'
    versions = ['Python 2.6', 'Python 3.1', 'Python 2.7', 'Python 3.2', 'Python 3.3', 'Python 3.4']

    @elwynd
    Copy link
    Mannequin Author

    elwynd mannequin commented Oct 29, 2012

    Enhancement requested for module mmap:
    Alter the interface of mmap.read from
    mmap.read(num)
    to
    mmap.read([num])
    reading the whole file if no argument provided.

    The read function in the mmap module (Modules/mmapmodule.c) *requires* an argument whereas for the standard file read function the argument is optional and the function reads the remainder of the file if absent.

    The mmap module knows how big the file is, so it should be no problem to internally use the remaining length if no argument is supplied.

    This would avoid having to write (for example)
    f = mmap.mmap(file_desc, file_size)
    b = f.read(file_size)
    j = json.loads(b)

    instead of
    f = mmap.mmap(file_desc, file_size)
    j = json.load(f)

    @elwynd elwynd mannequin added stdlib Python modules in the Lib dir type-feature A feature request or enhancement labels Oct 29, 2012
    @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
    stdlib Python modules in the Lib dir type-feature A feature request or enhancement
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant