Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 5a8a84b

Browse files
jusjusjusvstinner
authored andcommitted
Added :const:mmap.ACCESS_DEFAULT constant. (#4093)
1 parent c62f0cb commit 5a8a84b

3 files changed

Lines changed: 16 additions & 10 deletions

File tree

Doc/library/mmap.rst

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,16 +29,20 @@ still needs to be closed when done).
2929
mapping.
3030

3131
For both the Unix and Windows versions of the constructor, *access* may be
32-
specified as an optional keyword parameter. *access* accepts one of three
33-
values: :const:`ACCESS_READ`, :const:`ACCESS_WRITE`, or :const:`ACCESS_COPY`
34-
to specify read-only, write-through or copy-on-write memory respectively.
35-
*access* can be used on both Unix and Windows. If *access* is not specified,
36-
Windows mmap returns a write-through mapping. The initial memory values for
37-
all three access types are taken from the specified file. Assignment to an
38-
:const:`ACCESS_READ` memory map raises a :exc:`TypeError` exception.
39-
Assignment to an :const:`ACCESS_WRITE` memory map affects both memory and the
40-
underlying file. Assignment to an :const:`ACCESS_COPY` memory map affects
41-
memory but does not update the underlying file.
32+
specified as an optional keyword parameter. *access* accepts one of four
33+
values: :const:`ACCESS_READ`, :const:`ACCESS_WRITE`, or :const:`ACCESS_COPY` to
34+
specify read-only, write-through or copy-on-write memory respectively, or
35+
:const:`ACCESS_DEFAULT` to defer to *prot*. *access* can be used on both Unix
36+
and Windows. If *access* is not specified, Windows mmap returns a
37+
write-through mapping. The initial memory values for all three access types
38+
are taken from the specified file. Assignment to an :const:`ACCESS_READ`
39+
memory map raises a :exc:`TypeError` exception. Assignment to an
40+
:const:`ACCESS_WRITE` memory map affects both memory and the underlying file.
41+
Assignment to an :const:`ACCESS_COPY` memory map affects memory but does not
42+
update the underlying file.
43+
44+
.. versionchanged:: 3.7
45+
Added :const:`ACCESS_DEFAULT` constant.
4246

4347
To map anonymous memory, -1 should be passed as the fileno along with the length.
4448

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Add ``mmap.ACCESS_DEFAULT`` constant.

Modules/mmapmodule.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1466,6 +1466,7 @@ PyInit_mmap(void)
14661466

14671467
setint(dict, "ALLOCATIONGRANULARITY", (long)my_getallocationgranularity());
14681468

1469+
setint(dict, "ACCESS_DEFAULT", ACCESS_DEFAULT);
14691470
setint(dict, "ACCESS_READ", ACCESS_READ);
14701471
setint(dict, "ACCESS_WRITE", ACCESS_WRITE);
14711472
setint(dict, "ACCESS_COPY", ACCESS_COPY);

0 commit comments

Comments
 (0)