[3.14] gh-141004: Document PyRun_InteractiveOneObject (GH-141405) (GH-141485)
Some checks failed
Lint / lint (push) Has been cancelled
Tests / Change detection (push) Has been cancelled
Tests / (push) Has been cancelled
Tests / Sanitizers (push) Has been cancelled
Tests / Windows MSI (push) Has been cancelled
Tests / Docs (push) Has been cancelled
Tests / Check if the ABI has changed (push) Has been cancelled
Tests / Check if Autoconf files are up to date (push) Has been cancelled
Tests / Check if generated files are up to date (push) Has been cancelled
Tests / Ubuntu SSL tests with OpenSSL (push) Has been cancelled
Tests / Android (aarch64) (push) Has been cancelled
Tests / Android (x86_64) (push) Has been cancelled
Tests / iOS (push) Has been cancelled
Tests / WASI (push) Has been cancelled
Tests / Hypothesis tests on Ubuntu (push) Has been cancelled
Tests / Address sanitizer (push) Has been cancelled
Tests / Cross build Linux (push) Has been cancelled
Tests / CIFuzz (push) Has been cancelled
Tests / All required checks pass (push) Has been cancelled

gh-141004: Document `PyRun_InteractiveOneObject` (GH-141405)
(cherry picked from commit 26b7df2430)

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
This commit is contained in:
Miss Islington (bot) 2025-11-12 23:58:52 +01:00 committed by GitHub
parent 0b44bc3379
commit 42e0468209
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -100,6 +100,20 @@ the same library that the Python runtime is using.
Otherwise, Python may not handle script file with LF line ending correctly.
.. c:function:: int PyRun_InteractiveOneObject(FILE *fp, PyObject *filename, PyCompilerFlags *flags)
Read and execute a single statement from a file associated with an
interactive device according to the *flags* argument. The user will be
prompted using ``sys.ps1`` and ``sys.ps2``. *filename* must be a Python
:class:`str` object.
Returns ``0`` when the input was
executed successfully, ``-1`` if there was an exception, or an error code
from the :file:`errcode.h` include file distributed as part of Python if
there was a parse error. (Note that :file:`errcode.h` is not included by
:file:`Python.h`, so must be included specifically if needed.)
.. c:function:: int PyRun_InteractiveOne(FILE *fp, const char *filename)
This is a simplified interface to :c:func:`PyRun_InteractiveOneFlags` below,
@ -108,17 +122,10 @@ the same library that the Python runtime is using.
.. c:function:: int PyRun_InteractiveOneFlags(FILE *fp, const char *filename, PyCompilerFlags *flags)
Read and execute a single statement from a file associated with an
interactive device according to the *flags* argument. The user will be
prompted using ``sys.ps1`` and ``sys.ps2``. *filename* is decoded from the
Similar to :c:func:`PyRun_InteractiveOneObject`, but *filename* is a
:c:expr:`const char*`, which is decoded from the
:term:`filesystem encoding and error handler`.
Returns ``0`` when the input was
executed successfully, ``-1`` if there was an exception, or an error code
from the :file:`errcode.h` include file distributed as part of Python if
there was a parse error. (Note that :file:`errcode.h` is not included by
:file:`Python.h`, so must be included specifically if needed.)
.. c:function:: int PyRun_InteractiveLoop(FILE *fp, const char *filename)