[Python-checkins] bpo-39691: Clarify io.open_code behavior (GH-19824)

Shantanu webhook-mailer at python.org
Fri May 1 13:52:14 EDT 2020


https://github.com/python/cpython/commit/831d58d7865cb98fa09227dc614f4f3ce6af968b
commit: 831d58d7865cb98fa09227dc614f4f3ce6af968b
branch: master
author: Shantanu <hauntsaninja at users.noreply.github.com>
committer: GitHub <noreply at github.com>
date: 2020-05-01T18:52:10+01:00
summary:

bpo-39691: Clarify io.open_code behavior (GH-19824)

files:
M Doc/library/io.rst

diff --git a/Doc/library/io.rst b/Doc/library/io.rst
index f0987da9b6a4c..aecbec56866d7 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
 



More information about the Python-checkins mailing list