@@ -488,17 +488,8 @@ Initializing and finalizing the interpreter
488
488
strings other than those passed in (however, the contents of the strings
489
489
pointed to by the argument list are not modified).
490
490
491
- The return value will be ``0`` if the interpreter exits normally (i.e.,
492
- without an exception), ``1`` if the interpreter exits due to an exception,
493
- or ``2`` if the argument list does not represent a valid Python command
494
- line.
495
-
496
- Note that if an otherwise unhandled :exc:`SystemExit` is raised, this
497
- function will not return ``1``, but exit the process, as long as
498
- ``Py_InspectFlag`` is not set. If ``Py_InspectFlag`` is set, execution will
499
- drop into the interactive Python prompt, at which point a second otherwise
500
- unhandled :exc:`SystemExit` will still exit the process, while any other
501
- means of exiting will set the return value as described above.
491
+ The return value is ``2`` if the argument list does not represent a valid
492
+ Python command line, and otherwise the same as :c:func:`Py_RunMain`.
502
493
503
494
In terms of the CPython runtime configuration APIs documented in the
504
495
:ref:`runtime configuration <init-config>` section (and without accounting
@@ -535,23 +526,18 @@ Initializing and finalizing the interpreter
535
526
536
527
If :c:member:`PyConfig.inspect` is not set (the default), the return value
537
528
will be ``0`` if the interpreter exits normally (that is, without raising
538
- an exception), or ``1`` if the interpreter exits due to an exception. If an
539
- otherwise unhandled :exc:`SystemExit` is raised, the function will immediately
540
- exit the process instead of returning ``1``.
529
+ an exception), the exit status of an unhandled :exc:`SystemExit`, or ``1``
530
+ for any other unhandled exception.
541
531
542
532
If :c:member:`PyConfig.inspect` is set (such as when the :option: `-i ` option
543
533
is used), rather than returning when the interpreter exits, execution will
544
534
instead resume in an interactive Python prompt (REPL) using the ``__main__``
545
535
module's global namespace. If the interpreter exited with an exception, it
546
536
is immediately raised in the REPL session. The function return value is
547
- then determined by the way the *REPL session* terminates: returning ``0``
548
- if the session terminates without raising an unhandled exception, exiting
549
- immediately for an unhandled :exc:`SystemExit`, and returning ``1`` for
550
- any other unhandled exception.
551
-
552
- This function always finalizes the Python interpreter regardless of whether
553
- it returns a value or immediately exits the process due to an unhandled
554
- :exc:`SystemExit` exception.
537
+ then determined by the way the *REPL session* terminates: ``0``, ``1``, or
538
+ the status of a :exc:`SystemExit`, as specified above.
539
+
540
+ This function always finalizes the Python interpreter before it returns.
555
541
556
542
See :ref:`Python Configuration <init-python-config>` for an example of a
557
543
customized Python that always runs in isolated mode using
0 commit comments