diff options
Diffstat (limited to 'Modules/_testinternalcapi.c')
-rw-r--r-- | Modules/_testinternalcapi.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/Modules/_testinternalcapi.c b/Modules/_testinternalcapi.c index df4725ea0a1..ab6c5965d16 100644 --- a/Modules/_testinternalcapi.c +++ b/Modules/_testinternalcapi.c @@ -12,6 +12,7 @@ #define PY_SSIZE_T_CLEAN #include "Python.h" +#include "pycore_atomic_funcs.h" // _Py_atomic_int_get() #include "pycore_bitutils.h" // _Py_bswap32() #include "pycore_gc.h" // PyGC_Head #include "pycore_hashtable.h" // _Py_hashtable_new() @@ -267,6 +268,17 @@ error: } +static PyObject* +test_atomic_funcs(PyObject *self, PyObject *Py_UNUSED(args)) +{ + // Test _Py_atomic_size_get() and _Py_atomic_size_set() + Py_ssize_t var = 1; + _Py_atomic_size_set(&var, 2); + assert(_Py_atomic_size_get(&var) == 2); + Py_RETURN_NONE; +} + + static PyMethodDef TestMethods[] = { {"get_configs", get_configs, METH_NOARGS}, {"get_recursion_depth", get_recursion_depth, METH_NOARGS}, @@ -276,6 +288,7 @@ static PyMethodDef TestMethods[] = { {"test_hashtable", test_hashtable, METH_NOARGS}, {"get_config", test_get_config, METH_NOARGS}, {"set_config", test_set_config, METH_O}, + {"test_atomic_funcs", test_atomic_funcs, METH_NOARGS}, {NULL, NULL} /* sentinel */ }; |