Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit c9d7d32

Browse files
bpo-39691: Clarify io.open_code behavior (GH-19824)
(cherry picked from commit 831d58d) Co-authored-by: Shantanu <[email protected]>
1 parent 71e6122 commit c9d7d32

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

Doc/library/io.rst

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -132,12 +132,13 @@ High-level Module Interface
132132
Opens the provided file with mode ``'rb'``. This function should be used
133133
when the intent is to treat the contents as executable code.
134134

135-
``path`` should be an absolute path.
135+
``path`` should be a :class:`str` and an absolute path.
136136

137137
The behavior of this function may be overridden by an earlier call to the
138-
:c:func:`PyFile_SetOpenCodeHook`, however, it should always be considered
139-
interchangeable with ``open(path, 'rb')``. Overriding the behavior is
140-
intended for additional validation or preprocessing of the file.
138+
:c:func:`PyFile_SetOpenCodeHook`. However, assuming that ``path`` is a
139+
:class:`str` and an absolute path, ``open_code(path)`` should always behave
140+
the same as ``open(path, 'rb')``. Overriding the behavior is intended for
141+
additional validation or preprocessing of the file.
141142

142143
.. versionadded:: 3.8
143144

0 commit comments

Comments
 (0)