#8046: add context manager protocol support to mmap objects. Also add closed property.
diff --git a/Doc/library/mmap.rst b/Doc/library/mmap.rst
index 403e2f5..3e0854b 100644
--- a/Doc/library/mmap.rst
+++ b/Doc/library/mmap.rst
@@ -112,6 +112,18 @@
map.close()
+ :class:`mmap` can also be used as a context manager in a :keyword:`with`
+ statement.::
+
+ import mmap
+
+ with mmap.mmap(-1, 13) as map:
+ map.write("Hello world!")
+
+ .. versionadded:: 3.2
+ Context manager support.
+
+
The next example demonstrates how to create an anonymous map and exchange
data between the parent and child processes::
@@ -132,13 +144,19 @@
Memory-mapped file objects support the following methods:
-
.. method:: close()
Close the file. Subsequent calls to other methods of the object will
result in an exception being raised.
+ .. attribute:: closed
+
+ True if the file is closed.
+
+ .. versionadded:: 3.2
+
+
.. method:: find(sub[, start[, end]])
Returns the lowest index in the object where the subsequence *sub* is
@@ -236,5 +254,3 @@
position of the file pointer; the file position is advanced by ``1``. If
the mmap was created with :const:`ACCESS_READ`, then writing to it will
throw a :exc:`TypeError` exception.
-
-