Linux vps-61133.fhnet.fr 4.9.0-19-amd64 #1 SMP Debian 4.9.320-2 (2022-06-30) x86_64
Apache/2.4.25 (Debian)
Server IP : 93.113.207.21 & Your IP : 216.73.216.35
Domains :
Cant Read [ /etc/named.conf ]
User : www-data
Terminal
Auto Root
Create File
Create Folder
Localroot Suggester
Backdoor Destroyer
Readme
/
usr /
src /
Python-3.10.14 /
Modules /
Delete
Unzip
Name
Size
Permission
Date
Action
_blake2
[ DIR ]
drwxr-xr-x
2024-03-19 22:46
_ctypes
[ DIR ]
drwxr-xr-x
2024-03-19 22:46
_decimal
[ DIR ]
drwxr-xr-x
2024-03-19 22:46
_io
[ DIR ]
drwxr-xr-x
2024-03-19 22:46
_multiprocessing
[ DIR ]
drwxr-xr-x
2024-03-19 22:46
_sha3
[ DIR ]
drwxr-xr-x
2024-03-19 22:46
_sqlite
[ DIR ]
drwxr-xr-x
2024-03-19 22:46
_ssl
[ DIR ]
drwxr-xr-x
2024-03-19 22:46
_xxtestfuzz
[ DIR ]
drwxr-xr-x
2024-03-19 22:46
cjkcodecs
[ DIR ]
drwxr-xr-x
2024-03-19 22:46
clinic
[ DIR ]
drwxr-xr-x
2024-03-19 22:46
expat
[ DIR ]
drwxr-xr-x
2024-03-19 22:46
README
112
B
-rw-r--r--
2024-03-19 22:46
Setup
15.15
KB
-rw-r--r--
2024-03-19 22:46
Setup.local
41
B
-rw-r--r--
2025-06-04 09:17
_abc.c
26.09
KB
-rw-r--r--
2024-03-19 22:46
_abc.gcda
8.21
KB
-rw-r--r--
2025-06-04 09:21
_abc.o
228.27
KB
-rw-r--r--
2025-06-04 09:22
_asynciomodule.c
88.39
KB
-rw-r--r--
2024-03-19 22:46
_bisectmodule.c
8.03
KB
-rw-r--r--
2024-03-19 22:46
_bz2module.c
23.65
KB
-rw-r--r--
2024-03-19 22:46
_codecsmodule.c
32.8
KB
-rw-r--r--
2024-03-19 22:46
_codecsmodule.gcda
13.72
KB
-rw-r--r--
2025-06-04 09:21
_codecsmodule.o
374.94
KB
-rw-r--r--
2025-06-04 09:22
_collectionsmodule.c
79.83
KB
-rw-r--r--
2024-03-19 22:46
_collectionsmodule.gcda
14.42
KB
-rw-r--r--
2025-06-04 09:21
_collectionsmodule.o
325.15
KB
-rw-r--r--
2025-06-04 09:22
_contextvarsmodule.c
1.57
KB
-rw-r--r--
2024-03-19 22:46
_cryptmodule.c
1.66
KB
-rw-r--r--
2024-03-19 22:46
_csv.c
50.09
KB
-rw-r--r--
2024-03-19 22:46
_curses_panel.c
18.6
KB
-rw-r--r--
2024-03-19 22:46
_cursesmodule.c
135.6
KB
-rw-r--r--
2024-03-19 22:46
_datetimemodule.c
219.13
KB
-rw-r--r--
2024-03-19 22:46
_dbmmodule.c
14.9
KB
-rw-r--r--
2024-03-19 22:46
_elementtree.c
124.95
KB
-rw-r--r--
2024-03-19 22:46
_functoolsmodule.c
45.07
KB
-rw-r--r--
2024-03-19 22:46
_functoolsmodule.gcda
11.74
KB
-rw-r--r--
2025-06-04 09:21
_functoolsmodule.o
268.69
KB
-rw-r--r--
2025-06-04 09:22
_gdbmmodule.c
21.25
KB
-rw-r--r--
2024-03-19 22:46
_hashopenssl.c
59.7
KB
-rw-r--r--
2024-03-19 22:46
_heapqmodule.c
21.78
KB
-rw-r--r--
2024-03-19 22:46
_iomodule.gcda
6.99
KB
-rw-r--r--
2025-06-04 09:21
_iomodule.o
186.38
KB
-rw-r--r--
2025-06-04 09:22
_json.c
57.57
KB
-rw-r--r--
2024-03-19 22:46
_localemodule.c
22.29
KB
-rw-r--r--
2024-03-19 22:46
_localemodule.gcda
8.57
KB
-rw-r--r--
2025-06-04 09:21
_localemodule.o
181.06
KB
-rw-r--r--
2025-06-04 09:22
_lsprof.c
25.89
KB
-rw-r--r--
2024-03-19 22:46
_lzmamodule.c
48.65
KB
-rw-r--r--
2024-03-19 22:46
_math.c
7.33
KB
-rw-r--r--
2024-03-19 22:46
_math.gcda
2.29
KB
-rw-r--r--
2025-06-04 09:21
_math.h
1007
B
-rw-r--r--
2024-03-19 22:46
_math.o
32.3
KB
-rw-r--r--
2025-06-04 09:22
_opcode.c
2.14
KB
-rw-r--r--
2024-03-19 22:46
_operator.c
46.15
KB
-rw-r--r--
2024-03-19 22:46
_operator.gcda
13.14
KB
-rw-r--r--
2025-06-04 09:21
_operator.o
333.74
KB
-rw-r--r--
2025-06-04 09:22
_pickle.c
229.53
KB
-rw-r--r--
2024-03-19 22:46
_posixsubprocess.c
36.98
KB
-rw-r--r--
2024-03-19 22:46
_queuemodule.c
12.31
KB
-rw-r--r--
2024-03-19 22:46
_randommodule.c
17.76
KB
-rw-r--r--
2024-03-19 22:46
_scproxy.c
6.08
KB
-rw-r--r--
2024-03-19 22:46
_sre.c
79.74
KB
-rw-r--r--
2024-03-19 22:46
_sre.gcda
34.64
KB
-rw-r--r--
2025-06-04 09:21
_sre.o
975.16
KB
-rw-r--r--
2025-06-04 09:22
_ssl.c
186.63
KB
-rw-r--r--
2024-03-19 22:46
_ssl.h
2.08
KB
-rw-r--r--
2024-03-19 22:46
_ssl_data.h
203.14
KB
-rw-r--r--
2024-03-19 22:46
_ssl_data_111.h
208.74
KB
-rw-r--r--
2024-03-19 22:46
_ssl_data_300.h
275.25
KB
-rw-r--r--
2024-03-19 22:46
_stat.c
15.18
KB
-rw-r--r--
2024-03-19 22:46
_stat.gcda
5.7
KB
-rw-r--r--
2025-06-04 09:21
_stat.o
69.77
KB
-rw-r--r--
2025-06-04 09:22
_statisticsmodule.c
4.83
KB
-rw-r--r--
2024-03-19 22:46
_struct.c
68.85
KB
-rw-r--r--
2024-03-19 22:46
_testbuffer.c
82.19
KB
-rw-r--r--
2024-03-19 22:46
_testcapimodule.c
217.47
KB
-rw-r--r--
2024-03-19 22:46
_testclinic.c
22.92
KB
-rw-r--r--
2024-03-19 22:46
_testimportmultiple.c
1.1
KB
-rw-r--r--
2024-03-19 22:46
_testinternalcapi.c
10.76
KB
-rw-r--r--
2024-03-19 22:46
_testmultiphase.c
23.38
KB
-rw-r--r--
2024-03-19 22:46
_threadmodule.c
50.27
KB
-rw-r--r--
2024-03-19 22:46
_threadmodule.gcda
10.46
KB
-rw-r--r--
2025-06-04 09:21
_threadmodule.o
250.8
KB
-rw-r--r--
2025-06-04 09:22
_tkinter.c
93.36
KB
-rw-r--r--
2024-03-19 22:46
_tracemalloc.c
44.86
KB
-rw-r--r--
2024-03-19 22:46
_tracemalloc.gcda
12.51
KB
-rw-r--r--
2025-06-04 09:21
_tracemalloc.o
262.77
KB
-rw-r--r--
2025-06-04 09:22
_uuidmodule.c
3
KB
-rw-r--r--
2024-03-19 22:46
_weakref.c
4.92
KB
-rw-r--r--
2024-03-19 22:46
_weakref.gcda
4.24
KB
-rw-r--r--
2025-06-04 09:21
_weakref.o
84.91
KB
-rw-r--r--
2025-06-04 09:22
_winapi.c
66.78
KB
-rw-r--r--
2024-03-19 22:46
_xxsubinterpretersmodule.c
67.74
KB
-rw-r--r--
2024-03-19 22:46
_zoneinfo.c
73.89
KB
-rw-r--r--
2024-03-19 22:46
addrinfo.h
5.88
KB
-rw-r--r--
2024-03-19 22:46
arraymodule.c
87.46
KB
-rw-r--r--
2024-03-19 22:46
atexitmodule.c
7.29
KB
-rw-r--r--
2024-03-19 22:46
atexitmodule.gcda
4.45
KB
-rw-r--r--
2025-06-04 09:21
atexitmodule.o
97.11
KB
-rw-r--r--
2025-06-04 09:22
audioop.c
59.71
KB
-rw-r--r--
2024-03-19 22:46
binascii.c
54.76
KB
-rw-r--r--
2024-03-19 22:46
bufferedio.gcda
20.46
KB
-rw-r--r--
2025-06-04 09:21
bufferedio.o
414.2
KB
-rw-r--r--
2025-06-04 09:22
bytesio.gcda
10.84
KB
-rw-r--r--
2025-06-04 09:21
bytesio.o
220.71
KB
-rw-r--r--
2025-06-04 09:22
cmathmodule.c
42.3
KB
-rw-r--r--
2024-03-19 22:46
config.c
3.21
KB
-rw-r--r--
2025-06-04 09:17
config.c.in
1.58
KB
-rw-r--r--
2024-03-19 22:46
config.o
34.5
KB
-rw-r--r--
2025-06-04 09:22
errnomodule.c
27.08
KB
-rw-r--r--
2024-03-19 22:46
errnomodule.gcda
8.02
KB
-rw-r--r--
2025-06-04 09:21
errnomodule.o
113.31
KB
-rw-r--r--
2025-06-04 09:22
faulthandler.c
40.52
KB
-rw-r--r--
2024-03-19 22:46
faulthandler.gcda
9.1
KB
-rw-r--r--
2025-06-04 09:21
faulthandler.o
147.28
KB
-rw-r--r--
2025-06-04 09:22
fcntlmodule.c
20.49
KB
-rw-r--r--
2024-03-19 22:46
fileio.gcda
9.01
KB
-rw-r--r--
2025-06-04 09:21
fileio.o
227.98
KB
-rw-r--r--
2025-06-04 09:22
gc_weakref.txt
11.19
KB
-rw-r--r--
2024-03-19 22:46
gcmodule.c
77.27
KB
-rw-r--r--
2024-03-19 22:46
gcmodule.gcda
11.63
KB
-rw-r--r--
2025-06-04 09:21
gcmodule.o
306.44
KB
-rw-r--r--
2025-06-04 09:22
getaddrinfo.c
18.38
KB
-rw-r--r--
2024-03-19 22:46
getbuildinfo.c
1.28
KB
-rw-r--r--
2024-03-19 22:46
getbuildinfo.gcda
3.59
KB
-rw-r--r--
2025-06-04 09:21
getbuildinfo.o
33.84
KB
-rw-r--r--
2025-06-04 09:22
getnameinfo.c
6.18
KB
-rw-r--r--
2024-03-19 22:46
getpath.c
44.99
KB
-rw-r--r--
2024-03-19 22:46
getpath.gcda
8.82
KB
-rw-r--r--
2025-06-04 09:21
getpath.o
160.52
KB
-rw-r--r--
2025-06-04 09:22
grpmodule.c
8.52
KB
-rw-r--r--
2024-03-19 22:46
hashlib.h
2.09
KB
-rw-r--r--
2024-03-19 22:46
iobase.gcda
9.63
KB
-rw-r--r--
2025-06-04 09:21
iobase.o
189.36
KB
-rw-r--r--
2025-06-04 09:22
itertoolsmodule.c
153.67
KB
-rw-r--r--
2024-03-19 22:46
itertoolsmodule.gcda
27.9
KB
-rw-r--r--
2025-06-04 09:21
itertoolsmodule.o
721.27
KB
-rw-r--r--
2025-06-04 09:22
ld_so_aix
6.12
KB
-rwxr-xr-x
2025-06-04 09:17
ld_so_aix.in
6.11
KB
-rw-r--r--
2024-03-19 22:46
main.c
17.65
KB
-rw-r--r--
2024-03-19 22:46
main.gcda
7.28
KB
-rw-r--r--
2025-06-04 09:21
main.o
147.24
KB
-rw-r--r--
2025-06-04 09:22
makesetup
7.67
KB
-rwxr-xr-x
2024-03-19 22:46
makexp_aix
2.67
KB
-rwxr-xr-x
2024-03-19 22:46
mathmodule.c
106.2
KB
-rw-r--r--
2024-03-19 22:46
md5module.c
15.51
KB
-rw-r--r--
2024-03-19 22:46
mmapmodule.c
47.75
KB
-rw-r--r--
2024-03-19 22:46
nismodule.c
12.89
KB
-rw-r--r--
2024-03-19 22:46
ossaudiodev.c
37.49
KB
-rw-r--r--
2024-03-19 22:46
overlapped.c
53.65
KB
-rw-r--r--
2024-03-19 22:46
posixmodule.c
413.46
KB
-rw-r--r--
2024-03-19 22:46
posixmodule.gcda
67.8
KB
-rw-r--r--
2025-06-04 09:21
posixmodule.h
791
B
-rw-r--r--
2024-03-19 22:46
posixmodule.o
1.49
MB
-rw-r--r--
2025-06-04 09:22
pwdmodule.c
8.89
KB
-rw-r--r--
2024-03-19 22:46
pwdmodule.gcda
4.96
KB
-rw-r--r--
2025-06-04 09:21
pwdmodule.o
84.35
KB
-rw-r--r--
2025-06-04 09:22
pyexpat.c
60.39
KB
-rw-r--r--
2024-03-19 22:46
readline.c
40.06
KB
-rw-r--r--
2024-03-19 22:46
resource.c
13.77
KB
-rw-r--r--
2024-03-19 22:46
rotatingtree.c
3.39
KB
-rw-r--r--
2024-03-19 22:46
rotatingtree.h
924
B
-rw-r--r--
2024-03-19 22:46
selectmodule.c
70.06
KB
-rw-r--r--
2024-03-19 22:46
sha1module.c
14.76
KB
-rw-r--r--
2024-03-19 22:46
sha256module.c
22.5
KB
-rw-r--r--
2024-03-19 22:46
sha512module.c
27.29
KB
-rw-r--r--
2024-03-19 22:46
signalmodule.c
52.45
KB
-rw-r--r--
2024-03-19 22:46
signalmodule.gcda
11.11
KB
-rw-r--r--
2025-06-04 09:21
signalmodule.o
235.02
KB
-rw-r--r--
2025-06-04 09:22
socketmodule.c
243.34
KB
-rw-r--r--
2024-03-19 22:46
socketmodule.h
8.56
KB
-rw-r--r--
2024-03-19 22:46
spwdmodule.c
6.69
KB
-rw-r--r--
2024-03-19 22:46
sre.h
2.83
KB
-rw-r--r--
2024-03-19 22:46
sre_constants.h
2.81
KB
-rw-r--r--
2024-03-19 22:46
sre_lib.h
52.08
KB
-rw-r--r--
2024-03-19 22:46
stringio.gcda
9.64
KB
-rw-r--r--
2025-06-04 09:21
stringio.o
193.45
KB
-rw-r--r--
2025-06-04 09:22
symtablemodule.c
3.67
KB
-rw-r--r--
2024-03-19 22:46
symtablemodule.gcda
4.25
KB
-rw-r--r--
2025-06-04 09:21
symtablemodule.o
55.01
KB
-rw-r--r--
2025-06-04 09:22
syslogmodule.c
10.64
KB
-rw-r--r--
2024-03-19 22:46
termios.c
22.52
KB
-rw-r--r--
2024-03-19 22:46
testcapi_long.h
6.77
KB
-rw-r--r--
2024-03-19 22:46
textio.gcda
23.51
KB
-rw-r--r--
2025-06-04 09:21
textio.o
645.09
KB
-rw-r--r--
2025-06-04 09:22
timemodule.c
57.23
KB
-rw-r--r--
2024-03-19 22:46
timemodule.gcda
8.3
KB
-rw-r--r--
2025-06-04 09:21
timemodule.o
177.2
KB
-rw-r--r--
2025-06-04 09:22
tkappinit.c
4.71
KB
-rw-r--r--
2024-03-19 22:46
tkinter.h
881
B
-rw-r--r--
2024-03-19 22:46
unicodedata.c
44.69
KB
-rw-r--r--
2024-03-19 22:46
unicodedata_db.h
531.75
KB
-rw-r--r--
2024-03-19 22:46
unicodename_db.h
2.12
MB
-rw-r--r--
2024-03-19 22:46
winreparse.h
1.59
KB
-rw-r--r--
2024-03-19 22:46
xxlimited.c
9.23
KB
-rw-r--r--
2024-03-19 22:46
xxlimited_35.c
6.88
KB
-rw-r--r--
2024-03-19 22:46
xxmodule.c
12.56
KB
-rw-r--r--
2024-03-19 22:46
xxsubtype.c
10.78
KB
-rw-r--r--
2024-03-19 22:46
xxsubtype.gcda
4.45
KB
-rw-r--r--
2025-06-04 09:21
xxsubtype.o
54.38
KB
-rw-r--r--
2025-06-04 09:22
zlibmodule.c
46.52
KB
-rw-r--r--
2024-03-19 22:46
Save
Rename
/* Python interpreter main program */ #include "Python.h" #include "pycore_initconfig.h" // _PyArgv #include "pycore_interp.h" // _PyInterpreterState.sysdict #include "pycore_pathconfig.h" // _PyPathConfig_ComputeSysPath0() #include "pycore_pylifecycle.h" // _Py_PreInitializeFromPyArgv() #include "pycore_pystate.h" // _PyInterpreterState_GET() /* 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 \ "Type \"help\", \"copyright\", \"credits\" or \"license\" " \ "for more information." #ifdef __cplusplus extern "C" { #endif /* --- pymain_init() ---------------------------------------------- */ static PyStatus pymain_init(const _PyArgv *args) { PyStatus status; status = _PyRuntime_Initialize(); if (_PyStatus_EXCEPTION(status)) { return status; } PyPreConfig preconfig; PyPreConfig_InitPythonConfig(&preconfig); status = _Py_PreInitializeFromPyArgv(&preconfig, args); if (_PyStatus_EXCEPTION(status)) { return status; } PyConfig config; PyConfig_InitPythonConfig(&config); /* pass NULL as the config: config is read from command line arguments, environment variables, configuration files */ if (args->use_bytes_argv) { status = PyConfig_SetBytesArgv(&config, args->argc, args->bytes_argv); } else { status = PyConfig_SetArgv(&config, args->argc, args->wchar_argv); } if (_PyStatus_EXCEPTION(status)) { goto done; } status = Py_InitializeFromConfig(&config); if (_PyStatus_EXCEPTION(status)) { goto done; } status = _PyStatus_OK(); done: PyConfig_Clear(&config); return status; } /* --- 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 (config->run_command != NULL || config->run_filename != NULL || config->run_module != NULL); } /* Return non-zero if stdin is a TTY or if -i command line option is used */ static int stdin_is_interactive(const PyConfig *config) { return (isatty(fileno(stdin)) || config->interactive); } /* Display the current Python exception and return an exitcode */ static int pymain_err_print(int *exitcode_p) { int exitcode; if (_Py_HandleSystemExit(&exitcode)) { *exitcode_p = exitcode; return 1; } PyErr_Print(); return 0; } static int pymain_exit_err_print(void) { int exitcode = 1; pymain_err_print(&exitcode); return exitcode; } /* 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) { PyObject *sys_path0 = NULL, *importer; sys_path0 = PyUnicode_FromWideChar(filename, wcslen(filename)); if (sys_path0 == NULL) { goto error; } importer = PyImport_GetImporter(sys_path0); if (importer == NULL) { goto error; } if (importer == Py_None) { Py_DECREF(sys_path0); Py_DECREF(importer); return 0; } Py_DECREF(importer); *importer_p = sys_path0; return 0; error: Py_XDECREF(sys_path0); PySys_WriteStderr("Failed checking if argv[0] is an import path entry\n"); return pymain_err_print(exitcode); } static int pymain_sys_path_add_path0(PyInterpreterState *interp, PyObject *path0) { _Py_IDENTIFIER(path); PyObject *sys_path; PyObject *sysdict = interp->sysdict; if (sysdict != NULL) { sys_path = _PyDict_GetItemIdWithError(sysdict, &PyId_path); if (sys_path == NULL && PyErr_Occurred()) { return -1; } } else { sys_path = NULL; } if (sys_path == NULL) { PyErr_SetString(PyExc_RuntimeError, "unable to get sys.path"); return -1; } if (PyList_Insert(sys_path, 0, path0)) { return -1; } return 0; } static void pymain_header(const PyConfig *config) { if (config->quiet) { return; } if (!config->verbose && (config_run_code(config) || !stdin_is_interactive(config))) { return; } fprintf(stderr, "Python %s on %s\n", Py_GetVersion(), Py_GetPlatform()); if (config->site_import) { fprintf(stderr, "%s\n", COPYRIGHT); } } static void pymain_import_readline(const PyConfig *config) { if (config->isolated) { return; } if (!config->inspect && config_run_code(config)) { return; } if (!isatty(fileno(stdin))) { return; } PyObject *mod = PyImport_ImportModule("readline"); if (mod == NULL) { PyErr_Clear(); } else { Py_DECREF(mod); } } static int pymain_run_command(wchar_t *command) { PyObject *unicode, *bytes; int ret; unicode = PyUnicode_FromWideChar(command, -1); if (unicode == NULL) { goto error; } if (PySys_Audit("cpython.run_command", "O", unicode) < 0) { return pymain_exit_err_print(); } bytes = PyUnicode_AsUTF8String(unicode); Py_DECREF(unicode); if (bytes == NULL) { goto error; } PyCompilerFlags cf = _PyCompilerFlags_INIT; cf.cf_flags |= PyCF_IGNORE_COOKIE; ret = PyRun_SimpleStringFlags(PyBytes_AsString(bytes), &cf); Py_DECREF(bytes); return (ret != 0); error: PySys_WriteStderr("Unable to decode the command from the command line:\n"); return pymain_exit_err_print(); } static int pymain_run_module(const wchar_t *modname, int set_argv0) { PyObject *module, *runpy, *runmodule, *runargs, *result; if (PySys_Audit("cpython.run_module", "u", modname) < 0) { return pymain_exit_err_print(); } runpy = PyImport_ImportModule("runpy"); if (runpy == NULL) { fprintf(stderr, "Could not import runpy module\n"); return pymain_exit_err_print(); } runmodule = PyObject_GetAttrString(runpy, "_run_module_as_main"); if (runmodule == NULL) { fprintf(stderr, "Could not access runpy._run_module_as_main\n"); Py_DECREF(runpy); return pymain_exit_err_print(); } module = PyUnicode_FromWideChar(modname, wcslen(modname)); if (module == NULL) { fprintf(stderr, "Could not convert module name to unicode\n"); Py_DECREF(runpy); Py_DECREF(runmodule); return pymain_exit_err_print(); } runargs = PyTuple_Pack(2, module, set_argv0 ? Py_True : Py_False); if (runargs == NULL) { fprintf(stderr, "Could not create arguments for runpy._run_module_as_main\n"); Py_DECREF(runpy); Py_DECREF(runmodule); Py_DECREF(module); return pymain_exit_err_print(); } _Py_UnhandledKeyboardInterrupt = 0; result = PyObject_Call(runmodule, runargs, NULL); if (!result && PyErr_Occurred() == PyExc_KeyboardInterrupt) { _Py_UnhandledKeyboardInterrupt = 1; } Py_DECREF(runpy); Py_DECREF(runmodule); Py_DECREF(module); Py_DECREF(runargs); if (result == NULL) { return pymain_exit_err_print(); } Py_DECREF(result); return 0; } static int pymain_run_file_obj(PyObject *program_name, PyObject *filename, int skip_source_first_line) { if (PySys_Audit("cpython.run_file", "O", filename) < 0) { return pymain_exit_err_print(); } FILE *fp = _Py_fopen_obj(filename, "rb"); if (fp == NULL) { // Ignore the OSError PyErr_Clear(); PySys_FormatStderr("%S: can't open file %R: [Errno %d] %s\n", program_name, filename, errno, strerror(errno)); return 2; } if (skip_source_first_line) { int ch; /* Push back first newline so line numbers remain the same */ while ((ch = getc(fp)) != EOF) { if (ch == '\n') { (void)ungetc(ch, fp); break; } } } struct _Py_stat_struct sb; if (_Py_fstat_noraise(fileno(fp), &sb) == 0 && S_ISDIR(sb.st_mode)) { PySys_FormatStderr("%S: %R is a directory, cannot continue\n", program_name, filename); fclose(fp); return 1; } // Call pending calls like signal handlers (SIGINT) if (Py_MakePendingCalls() == -1) { fclose(fp); return pymain_exit_err_print(); } /* PyRun_AnyFileExFlags(closeit=1) calls fclose(fp) before running code */ PyCompilerFlags cf = _PyCompilerFlags_INIT; int run = _PyRun_AnyFileObject(fp, filename, 1, &cf); return (run != 0); } static int pymain_run_file(const PyConfig *config) { PyObject *filename = PyUnicode_FromWideChar(config->run_filename, -1); if (filename == NULL) { PyErr_Print(); return -1; } PyObject *program_name = PyUnicode_FromWideChar(config->program_name, -1); if (program_name == NULL) { Py_DECREF(filename); PyErr_Print(); return -1; } int res = pymain_run_file_obj(program_name, filename, config->skip_source_first_line); Py_DECREF(filename); Py_DECREF(program_name); return res; } static int pymain_run_startup(PyConfig *config, int *exitcode) { int ret; if (!config->use_environment) { return 0; } PyObject *startup = NULL; #ifdef MS_WINDOWS const wchar_t *env = _wgetenv(L"PYTHONSTARTUP"); if (env == NULL || env[0] == L'\0') { return 0; } startup = PyUnicode_FromWideChar(env, wcslen(env)); if (startup == NULL) { goto error; } #else const char *env = _Py_GetEnv(config->use_environment, "PYTHONSTARTUP"); if (env == NULL) { return 0; } startup = PyUnicode_DecodeFSDefault(env); if (startup == NULL) { goto error; } #endif if (PySys_Audit("cpython.run_startup", "O", startup) < 0) { goto error; } FILE *fp = _Py_fopen_obj(startup, "r"); if (fp == NULL) { int save_errno = errno; PyErr_Clear(); PySys_WriteStderr("Could not open PYTHONSTARTUP\n"); errno = save_errno; PyErr_SetFromErrnoWithFilenameObjects(PyExc_OSError, startup, NULL); goto error; } PyCompilerFlags cf = _PyCompilerFlags_INIT; (void) _PyRun_SimpleFileObject(fp, startup, 0, &cf); PyErr_Clear(); fclose(fp); ret = 0; done: Py_XDECREF(startup); return ret; error: ret = pymain_err_print(exitcode); goto done; } /* 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) { PyObject *sys, *hook, *result; sys = PyImport_ImportModule("sys"); if (sys == NULL) { goto error; } hook = PyObject_GetAttrString(sys, "__interactivehook__"); Py_DECREF(sys); if (hook == NULL) { PyErr_Clear(); return 0; } if (PySys_Audit("cpython.run_interactivehook", "O", hook) < 0) { goto error; } result = _PyObject_CallNoArg(hook); Py_DECREF(hook); if (result == NULL) { goto error; } Py_DECREF(result); return 0; error: PySys_WriteStderr("Failed calling sys.__interactivehook__\n"); return pymain_err_print(exitcode); } static int pymain_run_stdin(PyConfig *config) { if (stdin_is_interactive(config)) { config->inspect = 0; Py_InspectFlag = 0; /* do exit on SystemExit */ int exitcode; if (pymain_run_startup(config, &exitcode)) { return exitcode; } if (pymain_run_interactive_hook(&exitcode)) { return exitcode; } } /* call pending calls like signal handlers (SIGINT) */ if (Py_MakePendingCalls() == -1) { return pymain_exit_err_print(); } if (PySys_Audit("cpython.run_stdin", NULL) < 0) { return pymain_exit_err_print(); } PyCompilerFlags cf = _PyCompilerFlags_INIT; int run = PyRun_AnyFileExFlags(stdin, "<stdin>", 0, &cf); return (run != 0); } static void pymain_repl(PyConfig *config, int *exitcode) { /* Check this environment variable at the end, to give programs the opportunity to set it from Python. */ if (!config->inspect && _Py_GetEnv(config->use_environment, "PYTHONINSPECT")) { config->inspect = 1; Py_InspectFlag = 1; } if (!(config->inspect && stdin_is_interactive(config) && config_run_code(config))) { return; } config->inspect = 0; Py_InspectFlag = 0; if (pymain_run_interactive_hook(exitcode)) { return; } PyCompilerFlags cf = _PyCompilerFlags_INIT; int res = PyRun_AnyFileFlags(stdin, "<stdin>", &cf); *exitcode = (res != 0); } static void pymain_run_python(int *exitcode) { PyInterpreterState *interp = _PyInterpreterState_GET(); /* pymain_run_stdin() modify the config */ PyConfig *config = (PyConfig*)_PyInterpreterState_GetConfig(interp); PyObject *main_importer_path = NULL; if (config->run_filename != NULL) { /* If filename is a package (ex: directory or ZIP file) which contains __main__.py, main_importer_path is set to filename and will be prepended to sys.path. Otherwise, main_importer_path is left unchanged. */ if (pymain_get_importer(config->run_filename, &main_importer_path, exitcode)) { return; } } if (main_importer_path != NULL) { if (pymain_sys_path_add_path0(interp, main_importer_path) < 0) { goto error; } } else if (!config->isolated) { PyObject *path0 = NULL; int res = _PyPathConfig_ComputeSysPath0(&config->argv, &path0); if (res < 0) { goto error; } if (res > 0) { if (pymain_sys_path_add_path0(interp, path0) < 0) { Py_DECREF(path0); goto error; } Py_DECREF(path0); } } pymain_header(config); pymain_import_readline(config); if (config->run_command) { *exitcode = pymain_run_command(config->run_command); } else if (config->run_module) { *exitcode = pymain_run_module(config->run_module, 1); } else if (main_importer_path != NULL) { *exitcode = pymain_run_module(L"__main__", 0); } else if (config->run_filename != NULL) { *exitcode = pymain_run_file(config); } else { *exitcode = pymain_run_stdin(config); } pymain_repl(config, exitcode); goto done; error: *exitcode = pymain_exit_err_print(); done: Py_XDECREF(main_importer_path); } /* --- pymain_main() ---------------------------------------------- */ static void pymain_free(void) { _PyImport_Fini2(); /* Free global variables which cannot be freed in Py_Finalize(): configuration options set before Py_Initialize() which should remain valid after Py_Finalize(), since Py_Initialize()-Py_Finalize() can be called multiple times. */ _PyPathConfig_ClearGlobal(); _Py_ClearStandardStreamEncoding(); _Py_ClearArgcArgv(); _PyRuntime_Finalize(); } static int exit_sigint(void) { /* bpo-1054041: We need to exit via the * SIG_DFL handler for SIGINT if KeyboardInterrupt went unhandled. * If we don't, a calling process such as a shell may not know * about the user's ^C. https://www.cons.org/cracauer/sigint.html */ #if defined(HAVE_GETPID) && !defined(MS_WINDOWS) if (PyOS_setsig(SIGINT, SIG_DFL) == SIG_ERR) { perror("signal"); /* Impossible in normal environments. */ } else { kill(getpid(), SIGINT); } /* If setting SIG_DFL failed, or kill failed to terminate us, * there isn't much else we can do aside from an error code. */ #endif /* HAVE_GETPID && !MS_WINDOWS */ #ifdef MS_WINDOWS /* cmd.exe detects this, prints ^C, and offers to terminate. */ /* https://msdn.microsoft.com/en-us/library/cc704588.aspx */ return STATUS_CONTROL_C_EXIT; #else return SIGINT + 128; #endif /* !MS_WINDOWS */ } static void _Py_NO_RETURN pymain_exit_error(PyStatus status) { if (_PyStatus_IS_EXIT(status)) { /* If it's an error rather than a regular exit, leave Python runtime alive: Py_ExitStatusException() uses the current exception and use sys.stdout in this case. */ pymain_free(); } Py_ExitStatusException(status); } int Py_RunMain(void) { int exitcode = 0; pymain_run_python(&exitcode); if (Py_FinalizeEx() < 0) { /* Value unlikely to be confused with a non-error exit status or other special meaning */ exitcode = 120; } pymain_free(); if (_Py_UnhandledKeyboardInterrupt) { exitcode = exit_sigint(); } return exitcode; } static int pymain_main(_PyArgv *args) { PyStatus status = pymain_init(args); if (_PyStatus_IS_EXIT(status)) { pymain_free(); return status.exitcode; } if (_PyStatus_EXCEPTION(status)) { pymain_exit_error(status); } return Py_RunMain(); } int Py_Main(int argc, wchar_t **argv) { _PyArgv args = { .argc = argc, .use_bytes_argv = 0, .bytes_argv = NULL, .wchar_argv = argv}; return pymain_main(&args); } int Py_BytesMain(int argc, char **argv) { _PyArgv args = { .argc = argc, .use_bytes_argv = 1, .bytes_argv = argv, .wchar_argv = NULL}; return pymain_main(&args); } #ifdef __cplusplus } #endif