| OLD | NEW |
| 1 | 1 |
| 2 /* Python interpreter top-level routines, including init/exit */ | 2 /* Python interpreter top-level routines, including init/exit */ |
| 3 | 3 |
| 4 #include "Python.h" | 4 #include "Python.h" |
| 5 | 5 |
| 6 #include "Python-ast.h" | 6 #include "Python-ast.h" |
| 7 #undef Yield /* undefine macro conflicting with winbase.h */ | 7 #undef Yield /* undefine macro conflicting with winbase.h */ |
| 8 #include "grammar.h" | 8 #include "grammar.h" |
| 9 #include "node.h" | 9 #include "node.h" |
| 10 #include "token.h" | 10 #include "token.h" |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 static void err_input(perrdetail *); | 64 static void err_input(perrdetail *); |
| 65 static void err_free(perrdetail *); | 65 static void err_free(perrdetail *); |
| 66 static void initsigs(void); | 66 static void initsigs(void); |
| 67 static void call_py_exitfuncs(void); | 67 static void call_py_exitfuncs(void); |
| 68 static void wait_for_thread_shutdown(void); | 68 static void wait_for_thread_shutdown(void); |
| 69 static void call_ll_exitfuncs(void); | 69 static void call_ll_exitfuncs(void); |
| 70 extern int _PyUnicode_Init(void); | 70 extern int _PyUnicode_Init(void); |
| 71 extern void _PyUnicode_Fini(void); | 71 extern void _PyUnicode_Fini(void); |
| 72 extern int _PyLong_Init(void); | 72 extern int _PyLong_Init(void); |
| 73 extern void PyLong_Fini(void); | 73 extern void PyLong_Fini(void); |
| 74 extern void _PyRandom_Init(void); |
| 74 extern int _PyFaulthandler_Init(void); | 75 extern int _PyFaulthandler_Init(void); |
| 75 extern void _PyFaulthandler_Fini(void); | 76 extern void _PyFaulthandler_Fini(void); |
| 76 | 77 |
| 77 #ifdef WITH_THREAD | 78 #ifdef WITH_THREAD |
| 78 extern void _PyGILState_Init(PyInterpreterState *, PyThreadState *); | 79 extern void _PyGILState_Init(PyInterpreterState *, PyThreadState *); |
| 79 extern void _PyGILState_Fini(void); | 80 extern void _PyGILState_Fini(void); |
| 80 #endif /* WITH_THREAD */ | 81 #endif /* WITH_THREAD */ |
| 81 | 82 |
| 82 int Py_DebugFlag; /* Needed by parser.c */ | 83 int Py_DebugFlag; /* Needed by parser.c */ |
| 83 int Py_VerboseFlag; /* Needed by import.c */ | 84 int Py_VerboseFlag; /* Needed by import.c */ |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 #endif | 212 #endif |
| 212 | 213 |
| 213 if ((p = Py_GETENV("PYTHONDEBUG")) && *p != '\0') | 214 if ((p = Py_GETENV("PYTHONDEBUG")) && *p != '\0') |
| 214 Py_DebugFlag = add_flag(Py_DebugFlag, p); | 215 Py_DebugFlag = add_flag(Py_DebugFlag, p); |
| 215 if ((p = Py_GETENV("PYTHONVERBOSE")) && *p != '\0') | 216 if ((p = Py_GETENV("PYTHONVERBOSE")) && *p != '\0') |
| 216 Py_VerboseFlag = add_flag(Py_VerboseFlag, p); | 217 Py_VerboseFlag = add_flag(Py_VerboseFlag, p); |
| 217 if ((p = Py_GETENV("PYTHONOPTIMIZE")) && *p != '\0') | 218 if ((p = Py_GETENV("PYTHONOPTIMIZE")) && *p != '\0') |
| 218 Py_OptimizeFlag = add_flag(Py_OptimizeFlag, p); | 219 Py_OptimizeFlag = add_flag(Py_OptimizeFlag, p); |
| 219 if ((p = Py_GETENV("PYTHONDONTWRITEBYTECODE")) && *p != '\0') | 220 if ((p = Py_GETENV("PYTHONDONTWRITEBYTECODE")) && *p != '\0') |
| 220 Py_DontWriteBytecodeFlag = add_flag(Py_DontWriteBytecodeFlag, p); | 221 Py_DontWriteBytecodeFlag = add_flag(Py_DontWriteBytecodeFlag, p); |
| 222 |
| 223 _PyRandom_Init(); |
| 221 | 224 |
| 222 interp = PyInterpreterState_New(); | 225 interp = PyInterpreterState_New(); |
| 223 if (interp == NULL) | 226 if (interp == NULL) |
| 224 Py_FatalError("Py_Initialize: can't make first interpreter"); | 227 Py_FatalError("Py_Initialize: can't make first interpreter"); |
| 225 | 228 |
| 226 tstate = PyThreadState_New(interp); | 229 tstate = PyThreadState_New(interp); |
| 227 if (tstate == NULL) | 230 if (tstate == NULL) |
| 228 Py_FatalError("Py_Initialize: can't make first thread"); | 231 Py_FatalError("Py_Initialize: can't make first thread"); |
| 229 (void) PyThreadState_Swap(tstate); | 232 (void) PyThreadState_Swap(tstate); |
| 230 | 233 |
| (...skipping 2330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2561 #undef PyRun_InteractiveLoop | 2564 #undef PyRun_InteractiveLoop |
| 2562 PyAPI_FUNC(int) | 2565 PyAPI_FUNC(int) |
| 2563 PyRun_InteractiveLoop(FILE *f, const char *p) | 2566 PyRun_InteractiveLoop(FILE *f, const char *p) |
| 2564 { | 2567 { |
| 2565 return PyRun_InteractiveLoopFlags(f, p, NULL); | 2568 return PyRun_InteractiveLoopFlags(f, p, NULL); |
| 2566 } | 2569 } |
| 2567 | 2570 |
| 2568 #ifdef __cplusplus | 2571 #ifdef __cplusplus |
| 2569 } | 2572 } |
| 2570 #endif | 2573 #endif |
| OLD | NEW |