cpython/Modules/main.c

/* Python interpreter main program */

#include "Python.h"
#include "pycore_call.h"          // _PyObject_CallNoArgs()
#include "pycore_initconfig.h"    // _PyArgv
#include "pycore_interp.h"        // _PyInterpreterState.sysdict
#include "pycore_long.h"          // _PyLong_GetOne()
#include "pycore_pathconfig.h"    // _PyPathConfig_ComputeSysPath0()
#include "pycore_pylifecycle.h"   // _Py_PreInitializeFromPyArgv()
#include "pycore_pystate.h"       // _PyInterpreterState_GET()
#include "pycore_pythonrun.h"     // _PyRun_AnyFileObject()

/* Includes for exit_sigint() */
#include <stdio.h>                // perror()
#ifdef HAVE_SIGNAL_H
#  include <signal.h>             // SIGINT
#endif
#if defined(HAVE_GETPID) && defined(HAVE_UNISTD_H)
#  include <unistd.h>             // getpid()
#endif
#ifdef MS_WINDOWS
#  include <windows.h>            // STATUS_CONTROL_C_EXIT
#endif
/* End of includes for exit_sigint() */

#define COPYRIGHT

/* --- pymain_init() ---------------------------------------------- */

static PyStatus
pymain_init(const _PyArgv *args)
{}


/* --- pymain_run_python() ---------------------------------------- */

/* Non-zero if filename, command (-c) or module (-m) is set
   on the command line */
static inline int config_run_code(const PyConfig *config)
{}


/* Return non-zero if stdin is a TTY or if -i command line option is used */
static int
stdin_is_interactive(const PyConfig *config)
{}


/* Display the current Python exception and return an exitcode */
static int
pymain_err_print(int *exitcode_p)
{}


static int
pymain_exit_err_print(void)
{}


/* Write an exitcode into *exitcode and return 1 if we have to exit Python.
   Return 0 otherwise. */
static int
pymain_get_importer(const wchar_t *filename, PyObject **importer_p, int *exitcode)
{}


static int
pymain_sys_path_add_path0(PyInterpreterState *interp, PyObject *path0)
{}


static void
pymain_header(const PyConfig *config)
{}


static void
pymain_import_readline(const PyConfig *config)
{}


static int
pymain_run_command(wchar_t *command)
{}


static int
pymain_start_pyrepl_no_main(void)
{}


static int
pymain_run_module(const wchar_t *modname, int set_argv0)
{}


static int
pymain_run_file_obj(PyObject *program_name, PyObject *filename,
                    int skip_source_first_line)
{}

static int
pymain_run_file(const PyConfig *config)
{}


static int
pymain_run_startup(PyConfig *config, int *exitcode)
{}


/* Write an exitcode into *exitcode and return 1 if we have to exit Python.
   Return 0 otherwise. */
static int
pymain_run_interactive_hook(int *exitcode)
{}


static void
pymain_set_inspect(PyConfig *config, int inspect)
{}


static int
pymain_run_stdin(PyConfig *config)
{}


static void
pymain_repl(PyConfig *config, int *exitcode)
{}


static void
pymain_run_python(int *exitcode)
{}


/* --- pymain_main() ---------------------------------------------- */

static void
pymain_free(void)
{}


static int
exit_sigint(void)
{}


static void _Py_NO_RETURN
pymain_exit_error(PyStatus status)
{}


int
Py_RunMain(void)
{}


static int
pymain_main(_PyArgv *args)
{}


int
Py_Main(int argc, wchar_t **argv)
{}


int
Py_BytesMain(int argc, char **argv)
{}