Skip to content

Commit d66016c

Browse files
author
Rémy Voet (ryv)
committed
- Linting
- Remove useless change - Inline method ThreadHandle_set_bootstraped
1 parent 68628e0 commit d66016c

2 files changed

Lines changed: 4 additions & 11 deletions

File tree

Lib/test/test_threading.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,6 @@ def test_various_ops(self):
228228
self.assertNotEqual(t.ident, 0)
229229
self.assertIsNotNone(t.ident)
230230
self.assertRegex(repr(t), r'^<TestThread\(.*, stopped -?\d+\)>$')
231-
232231
if verbose:
233232
print('all tasks done')
234233
self.assertEqual(numrunning.get(), 0)

Modules/_threadmodule.c

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ ThreadHandle_decref(ThreadHandle *self)
289289
// 1. This is the destructor; nothing else holds a reference.
290290
// 2. The refcount going to zero is a "synchronizes-with" event; all
291291
// changes from other threads are visible.
292-
if ((self->state == THREAD_HANDLE_RUNNING || self->state == THREAD_HANDLE_FAILED)
292+
if ((self->state == THREAD_HANDLE_RUNNING || self->state == THREAD_HANDLE_FAILED)
293293
&& !detach_thread(self)) {
294294
self->state = THREAD_HANDLE_DONE;
295295
}
@@ -399,7 +399,7 @@ thread_run(void *boot_raw)
399399
"Exception ignored in thread started by %R", boot->func);
400400
}
401401
set_thread_handle_state(handle, THREAD_HANDLE_FAILED);
402-
// Notify that the bootstraped is done, in case the Python call didn't manage too (e.g. Memory error)
402+
// Notify that the bootstraped is done, in case the Python didn't bootstrap correctly (e.g. Memory error)
403403
_PyEvent_Notify(&handle->thread_is_bootstraped);
404404
}
405405
else {
@@ -497,7 +497,7 @@ ThreadHandle_start(ThreadHandle *self, PyObject *func, PyObject *args,
497497
self->state = THREAD_HANDLE_RUNNING;
498498
PyMutex_Unlock(&self->mutex);
499499

500-
// Unblock the thread and wait the running signal
500+
// Unblock the thread
501501
_PyEvent_Notify(&boot->handle_ready);
502502

503503
return 0;
@@ -633,12 +633,6 @@ ThreadHandle_set_done(ThreadHandle *self)
633633
return 0;
634634
}
635635

636-
static void
637-
ThreadHandle_set_bootstraped(ThreadHandle *self)
638-
{
639-
_PyEvent_Notify(&self->thread_is_bootstraped);
640-
}
641-
642636
// A wrapper around a ThreadHandle.
643637
typedef struct {
644638
PyObject_HEAD
@@ -749,7 +743,7 @@ static PyObject *
749743
PyThreadHandleObject_set_bootstraped(PyObject *op, PyObject *Py_UNUSED(dummy))
750744
{
751745
PyThreadHandleObject *self = PyThreadHandleObject_CAST(op);
752-
ThreadHandle_set_bootstraped(self->handle);
746+
_PyEvent_Notify(&self->handle->thread_is_bootstraped);
753747
Py_RETURN_NONE;
754748
}
755749

0 commit comments

Comments
 (0)