This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author pitrou
Recipients SilentGhost, eric.araujo, facundobatista, georg.brandl, josiahcarlson, lorenz, pitrou
Date 2011-01-12.19:09:45
SpamBayes Score 4.1660564e-12
Marked as misclassified No
Message-id <1294859388.67.0.120682010094.issue10897@psf.upfronthosting.co.za>
In-reply-to
Content
The problem is that it's a change in semantics. So it definitely can't be backported to the bugfix branches, nor committed into 3.2 which is in feature freeze now.

The question is which behaviour is the most expected by users of the module. I'd say that dup()ing definitely isn't intuitive, and it isn't documented; on the other hand, at least one of the examples seems to assume the original file descriptor is untouched when close()ing the mmap object:

with open("hello.txt", "r+b") as f:
    # memory-map the file, size 0 means whole file
    map = mmap.mmap(f.fileno(), 0)
    # read content via standard file methods
    print(map.readline())  # prints b"Hello Python!\n"
    # read content via slice notation
    print(map[:5])  # prints b"Hello"
    # update content using slice notation;
    # note that new content must have same size
    map[6:] = b" world!\n"
    # ... and read again using standard file methods
    map.seek(0)
    print(map.readline())  # prints b"Hello  world!\n"
    # close the map
    map.close()
History
Date User Action Args
2011-01-12 19:09:48pitrousetrecipients: + pitrou, georg.brandl, facundobatista, josiahcarlson, eric.araujo, SilentGhost, lorenz
2011-01-12 19:09:48pitrousetmessageid: <1294859388.67.0.120682010094.issue10897@psf.upfronthosting.co.za>
2011-01-12 19:09:45pitroulinkissue10897 messages
2011-01-12 19:09:45pitroucreate