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 0770202 commit af443c2Copy full SHA for af443c2
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 *op)
468
+{
469
+ HMACObject *self = HMACObject_CAST(op);
470
+ assert(self->name != NULL);
471
+ return PyUnicode_FromFormat("<%U HMAC object @ %p>", self->name, self);
472
+}
473
+
474
static int
475
HMACObject_clear(PyObject *op)
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