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 c7c3bf0 commit 080325fCopy full SHA for 080325f
Modules/hmacmodule.c
@@ -466,6 +466,14 @@ _hmac_HMAC_digest_size_get_impl(HMACObject *self)
466
return PyLong_FromUInt32(self->digest_size);
467
}
468
469
+static PyObject *
470
+HMACObject_repr(PyObject *self)
471
+{
472
+ HMACObject *hmac = HMACObject_CAST(self);
473
+ assert(hmac->name != NULL);
474
+ return PyUnicode_FromFormat("<%U HMAC object @ %p>", hmac->name, self);
475
+}
476
+
477
static int
478
HMACObject_clear(PyObject *self)
479
{
@@ -505,6 +513,7 @@ static PyGetSetDef HMACObject_getsets[] = {
505
513
};
506
514
507
515
static PyType_Slot HMACObject_Type_slots[] = {
516
+ {Py_tp_repr, HMACObject_repr},
508
517
{Py_tp_methods, HMACObject_methods},
509
518
{Py_tp_getset, HMACObject_getsets},
510
519
{Py_tp_clear, HMACObject_clear},
0 commit comments