FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

GitHub Viewer

#ifndef Py_BUILD_CORE_MODULE # define Py_BUILD_CORE_MODULE #endif /* Always enable assertion (even in release mode) */ #undef NDEBUG #include #include "pycore_initconfig.h" /* _PyConfig_InitCompatConfig() */ #include "pycore_pystate.h" /* _PyRuntime */ #include #include "pythread.h" #include #include #include /********************************************************* * Embedded interpreter tests that need a custom exe * * Executed via 'EmbeddingTests' in Lib/test/test_capi.py *********************************************************/ /* Use path starting with "./" avoids a search along the PATH */ #define PROGRAM_NAME L"./_testembed" static void _testembed_Py_Initialize(void) { Py_SetProgramName(PROGRAM_NAME); Py_Initialize(); } /***************************************************** * Test repeated initialisation and subinterpreters *****************************************************/ static void print_subinterp(void) { /* Output information about the interpreter in the format expected in Lib/test/test_capi.py (test_subinterps). */ PyThreadState *ts = PyThreadState_Get(); PyInterpreterState *interp = ts->interp; int64_t id = PyInterpreterState_GetID(interp); printf("interp %" PRId64 " , thread state : ", id, (uintptr_t)interp, (uintptr_t)ts); fflush(stdout); PyRun_SimpleString( "import sys;" "print('id(modules) =', id(sys.modules));" "sys.stdout.flush()" ); } static int test_repeated_init_and_subinterpreters(void) { PyThreadState *mainstate, *substate; PyGILState_STATE gilstate; int i, j; for (i=0; i 1) { for (struct TestCase *tc = TestCases; tc && tc->name; tc++) { if (strcmp(argv[1], tc->name) == 0) return (*tc->func)(); } } /* No match found, or no test name provided, so display usage */ printf("Python " PY_VERSION " _testembed executable for embedded interpreter tests\n" "Normally executed via 'EmbeddingTests' in Lib/test/test_embed.py\n\n" "Usage: %s TESTNAME\n\nAll available tests:\n", argv[0]); for (struct TestCase *tc = TestCases; tc && tc->name; tc++) { printf(" %s\n", tc->name); } /* Non-zero exit code will cause test_embed.py tests to fail. This is intentional. */ return -1; }

Back | FazBrowse Home | New Git URL