Skip to content

Commit

Permalink
bpo-39691: Clarify io.open_code behavior (pythonGH-19824)
Browse files Browse the repository at this point in the history
  • Loading branch information
hauntsaninja authored May 1, 2020
1 parent 4168f1e commit 831d58d
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions Doc/library/io.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 831d58d

Please sign in to comment.