Message126127
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() |
|
Date |
User |
Action |
Args |
2011-01-12 19:09:48 | pitrou | set | recipients:
+ pitrou, georg.brandl, facundobatista, josiahcarlson, eric.araujo, SilentGhost, lorenz |
2011-01-12 19:09:48 | pitrou | set | messageid: <1294859388.67.0.120682010094.issue10897@psf.upfronthosting.co.za> |
2011-01-12 19:09:45 | pitrou | link | issue10897 messages |
2011-01-12 19:09:45 | pitrou | create | |
|