diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2020-05-01 18:04:25 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-01 18:04:25 (GMT) |
commit | c9d7d32b6dc6140f7fcbf1ae1120df6d59fc28d0 (patch) | |
tree | 14d47a8bef585e61a7ec94822c0eb81dbb5f910a | |
parent | 71e6122b4428ae43e868e34db4f072635f58a555 (diff) | |
download | cpython-c9d7d32b6dc6140f7fcbf1ae1120df6d59fc28d0.zip cpython-c9d7d32b6dc6140f7fcbf1ae1120df6d59fc28d0.tar.gz cpython-c9d7d32b6dc6140f7fcbf1ae1120df6d59fc28d0.tar.bz2 |
bpo-39691: Clarify io.open_code behavior (GH-19824)
(cherry picked from commit 831d58d7865cb98fa09227dc614f4f3ce6af968b)
Co-authored-by: Shantanu <hauntsaninja@users.noreply.github.com>
-rw-r--r-- | Doc/library/io.rst | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/Doc/library/io.rst b/Doc/library/io.rst index 70e0115..32151a0 100644 --- a/Doc/library/io.rst +++ b/Doc/library/io.rst @@ -132,12 +132,13 @@ High-level Module Interface Opens the provided file with mode ``'rb'``. This function should be used when the intent is to treat the contents as executable code. - ``path`` should be an absolute path. + ``path`` should be a :class:`str` and an absolute path. The behavior of this function may be overridden by an earlier call to the - :c:func:`PyFile_SetOpenCodeHook`, however, it should always be considered - interchangeable with ``open(path, 'rb')``. Overriding the behavior is - intended for additional validation or preprocessing of the file. + :c:func:`PyFile_SetOpenCodeHook`. However, assuming that ``path`` is a + :class:`str` and an absolute path, ``open_code(path)`` should always behave + the same as ``open(path, 'rb')``. Overriding the behavior is intended for + additional validation or preprocessing of the file. .. versionadded:: 3.8 |