summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTommy Beadle <tbeadle@gmail.com>2016-06-02 15:41:20 -0400
committerTommy Beadle <tbeadle@gmail.com>2016-06-02 15:41:20 -0400
commit61e4722b5d80ccd456823234fdf3ea3605bb6db0 (patch)
tree0d942a3d60c027748167aed7e6746eee573c7df3
parent7938606e94f36bdcb5873c5d8fa380878b97a780 (diff)
downloadcpython-61e4722b5d80ccd456823234fdf3ea3605bb6db0.tar.gz
Issue #24617: Add comment for os.mkdir about mode quirks
-rw-r--r--Doc/library/os.rst14
1 files changed, 10 insertions, 4 deletions
diff --git a/Doc/library/os.rst b/Doc/library/os.rst
index 785b080cff..80de2bd475 100644
--- a/Doc/library/os.rst
+++ b/Doc/library/os.rst
@@ -1623,9 +1623,15 @@ features:
Create a directory named *path* with numeric mode *mode*.
+ If the directory already exists, :exc:`FileExistsError` is raised.
+
+ .. _mkdir_modebits:
+
On some systems, *mode* is ignored. Where it is used, the current umask
- value is first masked out. If the directory already exists,
- :exc:`FileExistsError` is raised.
+ value is first masked out. If bits other than the last 9 (i.e. the last 3
+ digits of the octal representation of the *mode*) are set, their meaning is
+ platform-dependent. On some platforms, they are ignored and you should call
+ :func:`chmod` explicitly to set them.
This function can also support :ref:`paths relative to directory descriptors
<dir_fd>`.
@@ -1646,8 +1652,8 @@ features:
Recursive directory creation function. Like :func:`mkdir`, but makes all
intermediate-level directories needed to contain the leaf directory.
- The default *mode* is ``0o777`` (octal). On some systems, *mode* is
- ignored. Where it is used, the current umask value is first masked out.
+ The *mode* parameter is passed to :func:`mkdir`; see :ref:`the mkdir()
+ description <mkdir_modebits>` for how it is interpreted.
If *exist_ok* is ``False`` (the default), an :exc:`OSError` is raised if the
target directory already exists.