gh-117968: Add tests for the part of the PyRun family of the C API (GH-117982)

Co-authored-by: NGRsoftlab <78017794+NGRsoftlab@users.noreply.github.com>
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
This commit is contained in:
Serhiy Storchaka 2024-04-17 23:45:35 +03:00 committed by GitHub
parent c1d7147c82
commit 6078f2033e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 235 additions and 1 deletions

View file

@ -3904,6 +3904,16 @@ PyInit__testcapi(void)
PyModule_AddIntConstant(m, "the_number_three", 3);
PyModule_AddIntMacro(m, Py_C_RECURSION_LIMIT);
if (PyModule_AddIntMacro(m, Py_single_input)) {
return NULL;
}
if (PyModule_AddIntMacro(m, Py_file_input)) {
return NULL;
}
if (PyModule_AddIntMacro(m, Py_eval_input)) {
return NULL;
}
testcapistate_t *state = get_testcapi_state(m);
state->error = PyErr_NewException("_testcapi.error", NULL, NULL);
PyModule_AddObject(m, "error", state->error);
@ -3998,6 +4008,9 @@ PyInit__testcapi(void)
if (_PyTestCapi_Init_PyAtomic(m) < 0) {
return NULL;
}
if (_PyTestCapi_Init_Run(m) < 0) {
return NULL;
}
if (_PyTestCapi_Init_Hash(m) < 0) {
return NULL;
}