• Home
  • Raw
  • Download

Lines Matching refs:pymain

52             pymain->err = _Py_INIT_USER_ERR("cannot decode " NAME); \
55 pymain->err = _Py_INIT_NO_MEMORY(); \
493 #define RUN_CODE(pymain) \ argument
494 (pymain->command != NULL || pymain->filename != NULL \
495 || pymain->module != NULL)
499 pymain_wstrdup(_PyMain *pymain, const wchar_t *str) in pymain_wstrdup() argument
503 pymain->err = _Py_INIT_NO_MEMORY(); in pymain_wstrdup()
521 pymain_init_cmdline_argv(_PyMain *pymain, _PyCoreConfig *config, in pymain_init_cmdline_argv() argument
526 if (pymain->use_bytes_argv) { in pymain_init_cmdline_argv()
528 size_t size = sizeof(wchar_t*) * (pymain->argc + 1); in pymain_init_cmdline_argv()
531 pymain->err = _Py_INIT_NO_MEMORY(); in pymain_init_cmdline_argv()
535 for (int i = 0; i < pymain->argc; i++) { in pymain_init_cmdline_argv()
537 wchar_t *arg = Py_DecodeLocale(pymain->bytes_argv[i], &len); in pymain_init_cmdline_argv()
540 pymain->err = DECODE_LOCALE_ERR("command line arguments", in pymain_init_cmdline_argv()
546 argv[pymain->argc] = NULL; in pymain_init_cmdline_argv()
551 cmdline->argv = pymain->wchar_argv; in pymain_init_cmdline_argv()
555 if (pymain->argc >= 1 && cmdline->argv != NULL) { in pymain_init_cmdline_argv()
561 config->program = pymain_wstrdup(pymain, program); in pymain_init_cmdline_argv()
571 pymain_clear_cmdline(_PyMain *pymain, _PyCmdline *cmdline) in pymain_clear_cmdline() argument
584 if (pymain->use_bytes_argv && cmdline->argv != NULL) { in pymain_clear_cmdline()
585 clear_wstrlist(pymain->argc, cmdline->argv); in pymain_clear_cmdline()
594 pymain_clear_pymain(_PyMain *pymain) in pymain_clear_pymain() argument
602 CLEAR(pymain->filename); in pymain_clear_pymain()
603 CLEAR(pymain->command); in pymain_clear_pymain()
604 CLEAR(pymain->module); in pymain_clear_pymain()
623 pymain_free_python(_PyMain *pymain) in pymain_free_python() argument
625 Py_CLEAR(pymain->main_importer_path); in pymain_free_python()
643 pymain_free_raw(_PyMain *pymain) in pymain_free_raw() argument
657 pymain_clear_pymain(pymain); in pymain_free_raw()
668 pymain_free(_PyMain *pymain) in pymain_free() argument
670 pymain_free_python(pymain); in pymain_free()
671 pymain_free_raw(pymain); in pymain_free()
676 pymain_run_main_from_importer(_PyMain *pymain) in pymain_run_main_from_importer() argument
686 if (PyList_Insert(sys_path, 0, pymain->main_importer_path)) { in pymain_run_main_from_importer()
694 Py_CLEAR(pymain->main_importer_path); in pymain_run_main_from_importer()
722 pymain_wstrlist_append(_PyMain *pymain, int *len, wchar_t ***list, const wchar_t *str) in pymain_wstrlist_append() argument
726 pymain->err = err; in pymain_wstrlist_append()
738 pymain_parse_cmdline_impl(_PyMain *pymain, _PyCoreConfig *config, in pymain_parse_cmdline_impl() argument
744 int c = _PyOS_GetOpt(pymain->argc, cmdline->argv, PROGRAM_OPTS, in pymain_parse_cmdline_impl()
757 pymain->err = _Py_INIT_NO_MEMORY(); in pymain_parse_cmdline_impl()
763 pymain->command = command; in pymain_parse_cmdline_impl()
771 pymain->module = pymain_wstrdup(pymain, _PyOS_optarg); in pymain_parse_cmdline_impl()
772 if (pymain->module == NULL) { in pymain_parse_cmdline_impl()
849 pymain->skip_first_line = 1; in pymain_parse_cmdline_impl()
862 if (pymain_wstrlist_append(pymain, in pymain_parse_cmdline_impl()
871 if (pymain_wstrlist_append(pymain, in pymain_parse_cmdline_impl()
895 if (pymain->command == NULL && pymain->module == NULL in pymain_parse_cmdline_impl()
896 && _PyOS_optind < pymain->argc in pymain_parse_cmdline_impl()
899 pymain->filename = pymain_wstrdup(pymain, cmdline->argv[_PyOS_optind]); in pymain_parse_cmdline_impl()
900 if (pymain->filename == NULL) { in pymain_parse_cmdline_impl()
906 assert(!(pymain->command != NULL && pymain->module != NULL)); in pymain_parse_cmdline_impl()
1089 pymain_init_stdio(_PyMain *pymain) in pymain_init_stdio() argument
1091 pymain->stdin_is_interactive = (isatty(fileno(stdin)) in pymain_init_stdio()
1229 pymain_header(_PyMain *pymain) in pymain_header() argument
1235 if (!Py_VerboseFlag && (RUN_CODE(pymain) || !pymain->stdin_is_interactive)) { in pymain_header()
1268 pymain_init_core_argv(_PyMain *pymain, _PyCoreConfig *config, in pymain_init_core_argv() argument
1272 int argc = pymain->argc - _PyOS_optind; in pymain_init_core_argv()
1286 pymain->err = _Py_INIT_NO_MEMORY(); in pymain_init_core_argv()
1291 if (pymain->command != NULL) { in pymain_init_core_argv()
1295 else if (pymain->module != NULL) { in pymain_init_core_argv()
1303 pymain->err = _Py_INIT_NO_MEMORY(); in pymain_init_core_argv()
1341 pymain_compute_path0(_PyMain *pymain, _PyCoreConfig *config, PyObject **path0) in pymain_compute_path0() argument
1343 if (pymain->main_importer_path != NULL) { in pymain_compute_path0()
1356 pymain->err = _Py_INIT_NO_MEMORY(); in pymain_compute_path0()
1364 pymain_update_sys_path(_PyMain *pymain, PyObject *path0) in pymain_update_sys_path() argument
1370 pymain->err = _Py_INIT_ERR("can't get sys.path"); in pymain_update_sys_path()
1376 pymain->err = _Py_INIT_ERR("sys.path.insert(0, path0) failed"); in pymain_update_sys_path()
1530 pymain_import_readline(_PyMain *pymain) in pymain_import_readline() argument
1535 if (!Py_InspectFlag && RUN_CODE(pymain)) { in pymain_import_readline()
1553 pymain_open_filename(_PyMain *pymain) in pymain_open_filename() argument
1558 fp = _Py_wfopen(pymain->filename, L"r"); in pymain_open_filename()
1563 cfilename_buffer = _Py_EncodeLocaleRaw(pymain->filename, NULL); in pymain_open_filename()
1571 pymain->status = 2; in pymain_open_filename()
1575 if (pymain->skip_first_line) { in pymain_open_filename()
1592 config->program, pymain->filename); in pymain_open_filename()
1594 pymain->status = 1; in pymain_open_filename()
1603 pymain_run_filename(_PyMain *pymain, PyCompilerFlags *cf) in pymain_run_filename() argument
1605 if (pymain->filename == NULL && pymain->stdin_is_interactive) { in pymain_run_filename()
1611 if (pymain->main_importer_path != NULL) { in pymain_run_filename()
1612 pymain->status = pymain_run_main_from_importer(pymain); in pymain_run_filename()
1617 if (pymain->filename != NULL) { in pymain_run_filename()
1618 fp = pymain_open_filename(pymain); in pymain_run_filename()
1627 pymain->status = pymain_run_file(fp, pymain->filename, cf); in pymain_run_filename()
1632 pymain_repl(_PyMain *pymain, PyCompilerFlags *cf) in pymain_repl() argument
1640 if (!(Py_InspectFlag && pymain->stdin_is_interactive && RUN_CODE(pymain))) { in pymain_repl()
1648 pymain->status = (res != 0); in pymain_repl()
1659 pymain_parse_cmdline(_PyMain *pymain, _PyCoreConfig *config, in pymain_parse_cmdline() argument
1662 int res = pymain_parse_cmdline_impl(pymain, config, cmdline); in pymain_parse_cmdline()
1668 pymain->status = 2; in pymain_parse_cmdline()
1672 if (pymain->command != NULL || pymain->module != NULL) { in pymain_parse_cmdline()
2015 pymain_read_conf_impl(_PyMain *pymain, _PyCoreConfig *config, in pymain_read_conf_impl() argument
2020 int res = pymain_parse_cmdline(pymain, config, cmdline); in pymain_read_conf_impl()
2035 pymain->err = err; in pymain_read_conf_impl()
2045 if (pymain_init_core_argv(pymain, config, cmdline) < 0) { in pymain_read_conf_impl()
2064 pymain->err = err; in pymain_read_conf_impl()
2074 pymain_read_conf(_PyMain *pymain, _PyCoreConfig *config, _PyCmdline *cmdline) in pymain_read_conf() argument
2082 pymain->err = _Py_INIT_NO_MEMORY(); in pymain_read_conf()
2094 pymain->err = _Py_INIT_NO_MEMORY(); in pymain_read_conf()
2105 pymain->err = _Py_INIT_ERR("Encoding changed twice while " in pymain_read_conf()
2114 if (pymain_init_cmdline_argv(pymain, config, cmdline) < 0) { in pymain_read_conf()
2118 int conf_res = pymain_read_conf_impl(pymain, config, cmdline); in pymain_read_conf()
2164 pymain->err = _Py_INIT_NO_MEMORY(); in pymain_read_conf()
2167 pymain_clear_cmdline(pymain, cmdline); in pymain_read_conf()
2168 pymain_clear_pymain(pymain); in pymain_read_conf()
2816 pymain_init_python_main(_PyMain *pymain, PyInterpreterState *interp) in pymain_init_python_main() argument
2828 pymain->err = err; in pymain_init_python_main()
2836 pymain_init_sys_path(_PyMain *pymain, _PyCoreConfig *config) in pymain_init_sys_path() argument
2838 if (pymain->filename != NULL) { in pymain_init_sys_path()
2843 pymain->main_importer_path = pymain_get_importer(pymain->filename); in pymain_init_sys_path()
2847 if (pymain_compute_path0(pymain, config, &path0) < 0) { in pymain_init_sys_path()
2852 if (pymain_update_sys_path(pymain, path0) < 0) { in pymain_init_sys_path()
2863 pymain_run_python(_PyMain *pymain) in pymain_run_python() argument
2867 pymain_header(pymain); in pymain_run_python()
2868 pymain_import_readline(pymain); in pymain_run_python()
2870 if (pymain->command) { in pymain_run_python()
2871 pymain->status = pymain_run_command(pymain->command, &cf); in pymain_run_python()
2873 else if (pymain->module) { in pymain_run_python()
2874 pymain->status = (pymain_run_module(pymain->module, 1) != 0); in pymain_run_python()
2877 pymain_run_filename(pymain, &cf); in pymain_run_python()
2880 pymain_repl(pymain, &cf); in pymain_run_python()
2885 pymain_cmdline_impl(_PyMain *pymain, _PyCoreConfig *config, in pymain_cmdline_impl() argument
2888 pymain->err = _PyRuntime_Initialize(); in pymain_cmdline_impl()
2889 if (_Py_INIT_FAILED(pymain->err)) { in pymain_cmdline_impl()
2893 int res = pymain_read_conf(pymain, config, cmdline); in pymain_cmdline_impl()
2914 orig_argv = copy_wstrlist(pymain->argc, cmdline->argv); in pymain_cmdline_impl()
2916 pymain->err = _Py_INIT_NO_MEMORY(); in pymain_cmdline_impl()
2919 orig_argc = pymain->argc; in pymain_cmdline_impl()
2923 pymain->err = err; in pymain_cmdline_impl()
2942 pymain_cmdline(_PyMain *pymain, _PyCoreConfig *config) in pymain_cmdline() argument
2958 int res = pymain_cmdline_impl(pymain, config, &cmdline); in pymain_cmdline()
2967 pymain_clear_cmdline(pymain, &cmdline); in pymain_cmdline()
2981 pymain_init(_PyMain *pymain) in pymain_init() argument
2999 int res = pymain_cmdline(pymain, config); in pymain_init()
3001 _Py_FatalInitError(pymain->err); in pymain_init()
3008 pymain_init_stdio(pymain); in pymain_init()
3011 pymain->err = _Py_InitializeCore(&interp, config); in pymain_init()
3012 if (_Py_INIT_FAILED(pymain->err)) { in pymain_init()
3013 _Py_FatalInitError(pymain->err); in pymain_init()
3019 if (pymain_init_python_main(pymain, interp) < 0) { in pymain_init()
3020 _Py_FatalInitError(pymain->err); in pymain_init()
3023 if (pymain_init_sys_path(pymain, config) < 0) { in pymain_init()
3024 _Py_FatalInitError(pymain->err); in pymain_init()
3031 pymain_main(_PyMain *pymain) in pymain_main() argument
3033 int res = pymain_init(pymain); in pymain_main()
3038 pymain_run_python(pymain); in pymain_main()
3043 pymain->status = 120; in pymain_main()
3047 pymain_free(pymain); in pymain_main()
3049 return pymain->status; in pymain_main()
3056 _PyMain pymain = _PyMain_INIT; in Py_Main() local
3057 pymain.use_bytes_argv = 0; in Py_Main()
3058 pymain.argc = argc; in Py_Main()
3059 pymain.wchar_argv = argv; in Py_Main()
3061 return pymain_main(&pymain); in Py_Main()
3068 _PyMain pymain = _PyMain_INIT; in _Py_UnixMain() local
3069 pymain.use_bytes_argv = 1; in _Py_UnixMain()
3070 pymain.argc = argc; in _Py_UnixMain()
3071 pymain.bytes_argv = argv; in _Py_UnixMain()
3073 return pymain_main(&pymain); in _Py_UnixMain()