We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
HMAC.__repr__()
1 parent 3876efa commit 89d2487Copy full SHA for 89d2487
Modules/hmacmodule.c
@@ -463,6 +463,14 @@ _hmac_HMAC_digest_size_get_impl(HMACObject *self)
463
return PyLong_FromUInt32(self->digest_size);
464
}
465
466
+static PyObject *
467
+HMACObject_repr(PyObject *self)
468
+{
469
+ HMACObject *hmac = HMACObject_CAST(self);
470
+ assert(hmac->name != NULL);
471
+ return PyUnicode_FromFormat("<%U HMAC object @ %p>", hmac->name, self);
472
+}
473
+
474
static int
475
HMACObject_clear(PyObject *self)
476
{
@@ -502,6 +510,7 @@ static PyGetSetDef HMACObject_getsets[] = {
502
510
};
503
511
504
512
static PyType_Slot HMACObject_Type_slots[] = {
513
+ {Py_tp_repr, HMACObject_repr},
505
514
{Py_tp_methods, HMACObject_methods},
506
515
{Py_tp_getset, HMACObject_getsets},
507
516
{Py_tp_clear, HMACObject_clear},
0 commit comments