@@ -48,10 +48,11 @@ update the underlying file.
4848
4949To map anonymous memory, -1 should be passed as the fileno along with the length.
5050
51- .. class :: mmap(fileno, length, tagname=None, access=ACCESS_DEFAULT, offset=0)
51+ .. class :: mmap(fileno, length, tagname=None, \
52+ access=ACCESS_DEFAULT, offset=0, *, trackfd=True)
5253
5354 **(Windows version) ** Maps *length * bytes from the file specified by the
54- file handle *fileno *, and creates a mmap object. If *length * is larger
55+ file descriptor *fileno *, and creates a mmap object. If *length * is larger
5556 than the current size of the file, the file is extended to contain *length *
5657 bytes. If *length * is ``0 ``, the maximum length of the map is the current
5758 size of the file, except that if the file is empty Windows raises an
@@ -69,6 +70,17 @@ To map anonymous memory, -1 should be passed as the fileno along with the length
6970 will be relative to the offset from the beginning of the file. *offset *
7071 defaults to 0. *offset * must be a multiple of the :const: `ALLOCATIONGRANULARITY `.
7172
73+ If *trackfd * is ``False ``, the file handle corresponding to *fileno * will
74+ not be duplicated, and the resulting :class: `!mmap ` object will not
75+ be associated with the map's underlying file.
76+ This means that the :meth: `~mmap.mmap.size ` and :meth: `~mmap.mmap.resize `
77+ methods will fail.
78+ This mode is useful to limit the number of open file handles.
79+ The original file can be renamed (but not deleted) after closing *fileno *.
80+
81+ .. versionchanged :: next
82+ The *trackfd * parameter was added.
83+
7284 .. audit-event :: mmap.__new__ fileno,length,access,offset mmap.mmap
7385
7486.. class :: mmap(fileno, length, flags=MAP_SHARED, prot=PROT_WRITE|PROT_READ, \
0 commit comments