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 enhancement request #49135

Closed
ndbecker mannequin opened this issue Jan 8, 2009 · 9 comments
Closed

mmap enhancement request #49135

ndbecker mannequin opened this issue Jan 8, 2009 · 9 comments
Labels
easy extension-modules C modules in the Modules dir type-feature A feature request or enhancement

Comments

@ndbecker
Copy link
Mannequin

ndbecker mannequin commented Jan 8, 2009

BPO 4885
Nosy @pitrou, @tiran
Files
  • issue-4885.patch
  • 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 2013-08-05.21:18:13.664>
    created_at = <Date 2009-01-08.20:18:12.840>
    labels = ['extension-modules', 'easy', 'type-feature']
    title = 'mmap enhancement request'
    updated_at = <Date 2013-08-05.21:18:13.663>
    user = 'https://bugs.python.org/ndbecker'

    bugs.python.org fields:

    activity = <Date 2013-08-05.21:18:13.663>
    actor = 'pitrou'
    assignee = 'none'
    closed = True
    closed_date = <Date 2013-08-05.21:18:13.664>
    closer = 'pitrou'
    components = ['Extension Modules']
    creation = <Date 2009-01-08.20:18:12.840>
    creator = 'ndbecker'
    dependencies = []
    files = ['31115']
    hgrepos = []
    issue_num = 4885
    keywords = ['patch', 'easy']
    message_count = 9.0
    messages = ['79433', '79435', '192658', '192659', '194156', '194176', '194215', '194509', '194510']
    nosy_count = 5.0
    nosy_names = ['pitrou', 'christian.heimes', 'ndbecker', 'python-dev', 'lambertv']
    pr_nums = []
    priority = 'low'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue4885'
    versions = ['Python 3.4']

    @ndbecker
    Copy link
    Mannequin Author

    ndbecker mannequin commented Jan 8, 2009

    I'd like to suggest some improvements from mmap

    1. mmap assign to slice only accepts a string. This is unfortunate,
      because AFAIK a string can only be created by copying data, and this is
      wasteful for large data transfers. mmap should accept any object
      supporting buffer protocol as well as string.

    2. buffer (mmap_obj) gives a read_only buffer. There should be a way to
      make this read_write. I suggest 'as_buffer' member.

    3. mmap_obj does not support weak ref. This is needed for proper
      lifetime management using boost::python

    @ndbecker ndbecker mannequin added stdlib Python modules in the Lib dir type-feature A feature request or enhancement labels Jan 8, 2009
    @pitrou
    Copy link
    Member

    pitrou commented Jan 8, 2009

    As for 2), the buffer() function is deprecated and is replaced in 3.0 by
    new object called memoryview() (together with a revamped internal API
    for taking and releasing buffers).

    @tiran
    Copy link
    Member

    tiran commented Jul 8, 2013

    1. and 2) have been fixed in Python 3.x. mmap supports writable memory views and slice assignment from any object that supports the buffer protocol.

    2. is still an issue as mmap objects are not weakref-able yet. It should be easy to add __weakref__ to mmap objects.

    @tiran tiran added extension-modules C modules in the Modules dir and removed stdlib Python modules in the Lib dir labels Jul 8, 2013
    @tiran
    Copy link
    Member

    tiran commented Jul 8, 2013

    It's a trivial task for any Python developer with some C experience.

    @tiran tiran added the easy label Jul 8, 2013
    @lambertv
    Copy link
    Mannequin

    lambertv mannequin commented Aug 2, 2013

    I've uploaded a patch to make mmap_obj support weakref. A test is included in the patch.

    @pitrou
    Copy link
    Member

    pitrou commented Aug 2, 2013

    Thanks Valerie. I've tested your patch and it looks good to me.
    Have you signed and sent a contributor's agreement?
    http://www.python.org/psf/contrib/

    @lambertv
    Copy link
    Mannequin

    lambertv mannequin commented Aug 2, 2013

    I just signed and sent the agreement electronically. Let me know if there is anything else I need to do.

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Aug 5, 2013

    New changeset 1754b7900da1 by Antoine Pitrou in branch 'default':
    Issue bpo-4885: Add weakref support to mmap objects. Patch by Valerie Lambert.
    http://hg.python.org/cpython/rev/1754b7900da1

    @pitrou
    Copy link
    Member

    pitrou commented Aug 5, 2013

    Your patch is now committed. Thanks for contributing!

    @pitrou pitrou closed this as completed Aug 5, 2013
    @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
    easy extension-modules C modules in the Modules dir type-feature A feature request or enhancement
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants