]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-39691: Clarify io.open_code behavior (GH-19824)
authorShantanu <hauntsaninja@users.noreply.github.com>
Fri, 1 May 2020 17:52:10 +0000 (10:52 -0700)
committerGitHub <noreply@github.com>
Fri, 1 May 2020 17:52:10 +0000 (18:52 +0100)
Doc/library/io.rst

index f0987da9b6a4cbb5ea60fc5e3852d81ef9975ef1..aecbec56866d73d1127e0ac3d7c659d5c4a56dba 100644 (file)
@@ -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