Kaydet (Commit) 5a8a84b3 authored tarafından Justus Schwabedal's avatar Justus Schwabedal Kaydeden (comit) Victor Stinner

Added :const:`mmap.ACCESS_DEFAULT` constant. (#4093)

üst c62f0cb3
...@@ -29,16 +29,20 @@ still needs to be closed when done). ...@@ -29,16 +29,20 @@ still needs to be closed when done).
mapping. mapping.
For both the Unix and Windows versions of the constructor, *access* may be For both the Unix and Windows versions of the constructor, *access* may be
specified as an optional keyword parameter. *access* accepts one of three specified as an optional keyword parameter. *access* accepts one of four
values: :const:`ACCESS_READ`, :const:`ACCESS_WRITE`, or :const:`ACCESS_COPY` values: :const:`ACCESS_READ`, :const:`ACCESS_WRITE`, or :const:`ACCESS_COPY` to
to specify read-only, write-through or copy-on-write memory respectively. specify read-only, write-through or copy-on-write memory respectively, or
*access* can be used on both Unix and Windows. If *access* is not specified, :const:`ACCESS_DEFAULT` to defer to *prot*. *access* can be used on both Unix
Windows mmap returns a write-through mapping. The initial memory values for and Windows. If *access* is not specified, Windows mmap returns a
all three access types are taken from the specified file. Assignment to an write-through mapping. The initial memory values for all three access types
:const:`ACCESS_READ` memory map raises a :exc:`TypeError` exception. are taken from the specified file. Assignment to an :const:`ACCESS_READ`
Assignment to an :const:`ACCESS_WRITE` memory map affects both memory and the memory map raises a :exc:`TypeError` exception. Assignment to an
underlying file. Assignment to an :const:`ACCESS_COPY` memory map affects :const:`ACCESS_WRITE` memory map affects both memory and the underlying file.
memory but does not update the underlying file. Assignment to an :const:`ACCESS_COPY` memory map affects memory but does not
update the underlying file.
.. versionchanged:: 3.7
Added :const:`ACCESS_DEFAULT` constant.
To map anonymous memory, -1 should be passed as the fileno along with the length. To map anonymous memory, -1 should be passed as the fileno along with the length.
......
...@@ -1466,6 +1466,7 @@ PyInit_mmap(void) ...@@ -1466,6 +1466,7 @@ PyInit_mmap(void)
setint(dict, "ALLOCATIONGRANULARITY", (long)my_getallocationgranularity()); setint(dict, "ALLOCATIONGRANULARITY", (long)my_getallocationgranularity());
setint(dict, "ACCESS_DEFAULT", ACCESS_DEFAULT);
setint(dict, "ACCESS_READ", ACCESS_READ); setint(dict, "ACCESS_READ", ACCESS_READ);
setint(dict, "ACCESS_WRITE", ACCESS_WRITE); setint(dict, "ACCESS_WRITE", ACCESS_WRITE);
setint(dict, "ACCESS_COPY", ACCESS_COPY); setint(dict, "ACCESS_COPY", ACCESS_COPY);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment