diff options
Diffstat (limited to 'Programs')
| -rw-r--r-- | Programs/_testembed.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/Programs/_testembed.c b/Programs/_testembed.c index e68e68de32..52a0b5124a 100644 --- a/Programs/_testembed.c +++ b/Programs/_testembed.c @@ -125,6 +125,28 @@ static int test_forced_io_encoding(void) return 0; } + +/********************************************************* + * Test parts of the C-API that work before initialization + *********************************************************/ + +static int test_pre_initialization_api(void) +{ + wchar_t *program = Py_DecodeLocale("spam", NULL); + if (program == NULL) { + fprintf(stderr, "Fatal error: cannot decode program name\n"); + return 1; + } + Py_SetProgramName(program); + + Py_Initialize(); + Py_Finalize(); + + PyMem_RawFree(program); + return 0; +} + + /* ********************************************************* * List of test cases and the function that implements it. * @@ -146,6 +168,7 @@ struct TestCase static struct TestCase TestCases[] = { { "forced_io_encoding", test_forced_io_encoding }, { "repeated_init_and_subinterpreters", test_repeated_init_and_subinterpreters }, + { "pre_initialization_api", test_pre_initialization_api }, { NULL, NULL } }; |
