Skip to content

Commit 45b9cf2

Browse files
Use Argument Clinic for the ident getter of _ThreadHandle
1 parent 1639136 commit 45b9cf2

2 files changed

Lines changed: 30 additions & 5 deletions

File tree

Modules/_threadmodule.c

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -678,11 +678,17 @@ PyThreadHandleObject_repr(PyObject *op)
678678
Py_TYPE(self)->tp_name, ident);
679679
}
680680

681+
/*[clinic input]
682+
@getter
683+
_thread._ThreadHandle.ident
684+
[clinic start generated code]*/
685+
681686
static PyObject *
682-
PyThreadHandleObject_get_ident(PyObject *op, void *Py_UNUSED(closure))
687+
_thread__ThreadHandle_ident_get_impl(PyObject *self)
688+
/*[clinic end generated code: output=66d40aa1a624ac23 input=2b3361e34a6ca79d]*/
683689
{
684-
PyThreadHandleObject *self = PyThreadHandleObject_CAST(op);
685-
return PyLong_FromUnsignedLongLong(ThreadHandle_ident(self->handle));
690+
PyThreadHandleObject *handle = PyThreadHandleObject_CAST(self);
691+
return PyLong_FromUnsignedLongLong(ThreadHandle_ident(handle->handle));
686692
}
687693

688694
/*[clinic input]
@@ -748,7 +754,7 @@ _thread__ThreadHandle__set_done_impl(PyObject *self)
748754
}
749755

750756
static PyGetSetDef ThreadHandle_getsetlist[] = {
751-
{"ident", PyThreadHandleObject_get_ident, NULL, NULL},
757+
_THREAD__THREADHANDLE_IDENT_GETSETDEF
752758
{0},
753759
};
754760

Modules/clinic/_threadmodule.c.h

Lines changed: 20 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)