Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions Doc/c-api/file.rst
Original file line number Diff line number Diff line change
Expand Up @@ -60,18 +60,21 @@ the :mod:`io` APIs instead.
raised if the end of the file is reached immediately.


.. c:type:: PyObject * (*Py_OpenCodeHookFunction)(PyObject *, void *)

Equivalent of :c:expr:`PyObject *(\*)(PyObject *path,
void *userData)`, where *path* is guaranteed to be
:c:type:`PyUnicodeObject`.

.. versionadded:: 3.8


.. c:function:: int PyFile_SetOpenCodeHook(Py_OpenCodeHookFunction handler)

Overrides the normal behavior of :func:`io.open_code` to pass its parameter
through the provided handler.

The handler is a function of type:

.. c:type:: Py_OpenCodeHookFunction

Equivalent of :c:expr:`PyObject *(\*)(PyObject *path,
void *userData)`, where *path* is guaranteed to be
:c:type:`PyUnicodeObject`.
The *handler* is a function of type :c:type:`Py_OpenCodeHookFunction`.

The *userData* pointer is passed into the hook function. Since hook
functions may be called from different runtimes, this pointer should not
Expand Down