C API tests: use special markers to test that output parameters were set (GH-109014)

This commit is contained in:
Serhiy Storchaka 2023-09-06 22:02:01 +03:00 • committed by GitHub
parent db1ee6a19a
commit bf414b7fcb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 60 additions and 30 deletions

View file

@ -1,4 +1,5 @@
#include "parts.h"
#include "util.h"
static Py_ssize_t
get_code_extra_index(PyInterpreterState* interp) {
@ -75,7 +76,7 @@ test_code_extra(PyObject* self, PyObject *Py_UNUSED(callable))
}
// Check the value is initially NULL
void *extra;
void *extra = UNINITIALIZED_PTR;
int res = PyUnstable_Code_GetExtra(test_func_code, code_extra_index, &extra);
if (res < 0) {
goto finally;
@ -88,6 +89,7 @@ test_code_extra(PyObject* self, PyObject *Py_UNUSED(callable))
goto finally;
}
// Assert it was set correctly
extra = UNINITIALIZED_PTR;
res = PyUnstable_Code_GetExtra(test_func_code, code_extra_index, &extra);
if (res < 0) {
goto finally;