-
-
Notifications
You must be signed in to change notification settings - Fork 33.3k
Closed
Labels
testsTests in the Lib/test dirTests in the Lib/test dirtopic-free-threadingtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Description
Bug report
On systems where Py_CAN_START_THREADS is not defined (like wasm32-wasi 3.x), test_critical_sections_threads is not created:
cpython/Modules/_testinternalcapi/test_critical_sections.c
Lines 173 to 177 in 192d17c
| #ifdef Py_CAN_START_THREADS | |
| static PyObject * | |
| test_critical_sections_threads(PyObject *self, PyObject *Py_UNUSED(args)) | |
| { | |
| const Py_ssize_t NUM_THREADS = 4; |
But, thread_critical_sections and struct test_data are always created. This leaves them unused in this case:
cpython/Modules/_testinternalcapi/test_critical_sections.c
Lines 132 to 144 in 192d17c
| struct test_data { | |
| PyObject *obj1; | |
| PyObject *obj2; | |
| PyObject *obj3; | |
| Py_ssize_t countdown; | |
| PyEvent done_event; | |
| }; | |
| static void | |
| thread_critical_sections(void *arg) | |
| { | |
| const Py_ssize_t NUM_ITERS = 200; |
I propose to move #ifdef Py_CAN_START_THREADS upper to cover all the test utils as well.
Buildbot link with a warning: https://buildbot.python.org/all/#/builders/1046/builds/5439
../../Modules/_testinternalcapi/test_critical_sections.c:142:1: warning: unused function 'thread_critical_sections' [-Wunused-function]
1 warning generated.
Linked PRs
Metadata
Metadata
Assignees
Labels
testsTests in the Lib/test dirTests in the Lib/test dirtopic-free-threadingtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error