Skip to content

Commit 4b91e11

Browse files
committed
BUG
1 parent b75d73a commit 4b91e11

1 file changed

Lines changed: 10 additions & 9 deletions

File tree

src/_xxhash.c

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -587,7 +587,7 @@ PYXXH32_get_digest_size(PYXXH32Object *self, void *closure)
587587
static PyObject *
588588
PYXXH32_get_name(PYXXH32Object *self, void *closure)
589589
{
590-
return PyUnicode_FromStringAndSize("XXH32", 5);
590+
return PyUnicode_FromStringAndSize("XXH32", sizeof("XXH32"));
591591
}
592592

593593
static PyObject *
@@ -895,7 +895,7 @@ PYXXH64_get_digest_size(PYXXH64Object *self, void *closure)
895895
static PyObject *
896896
PYXXH64_get_name(PYXXH64Object *self, void *closure)
897897
{
898-
return PyUnicode_FromStringAndSize("XXH64", 5);
898+
return PyUnicode_FromStringAndSize("XXH64", sizeof("XXH64"));
899899
}
900900

901901
static PyObject *
@@ -1204,7 +1204,7 @@ PYXXH3_64_get_digest_size(PYXXH3_64Object *self, void *closure)
12041204
static PyObject *
12051205
PYXXH3_64_get_name(PYXXH3_64Object *self, void *closure)
12061206
{
1207-
return PyUnicode_FromStringAndSize("XXH3_64", 7);
1207+
return PyUnicode_FromStringAndSize("XXH3_64", sizeof("XXH3_64"));
12081208
}
12091209

12101210
static PyObject *
@@ -1349,7 +1349,8 @@ static PyObject *PYXXH3_128_new(PyTypeObject *type, PyObject *args, PyObject *kw
13491349
return NULL;
13501350
}
13511351

1352-
XXH3_64bits_reset_withSeed(self->xxhash_state, 0);
1352+
self->seed = 0;
1353+
XXH3_128bits_reset_withSeed(self->xxhash_state, 0);
13531354

13541355
return (PyObject *)self;
13551356
}
@@ -1472,8 +1473,8 @@ static PyObject *PYXXH3_128_intdigest(PYXXH3_128Object *self)
14721473

14731474
PyDoc_STRVAR(
14741475
PYXXH3_128_copy_doc,
1475-
"copy() -> xxh64 object\n\n"
1476-
"Return a copy (``clone'') of the xxh64 object.");
1476+
"copy() -> xxh3_128 object\n\n"
1477+
"Return a copy (``clone'') of the xxh3_128 object.");
14771478

14781479
static PyObject *PYXXH3_128_copy(PYXXH3_128Object *self)
14791480
{
@@ -1528,7 +1529,7 @@ PYXXH3_128_get_digest_size(PYXXH3_128Object *self, void *closure)
15281529
static PyObject *
15291530
PYXXH3_128_get_name(PYXXH3_128Object *self, void *closure)
15301531
{
1531-
return PyUnicode_FromStringAndSize("XXH3_64", 7);
1532+
return PyUnicode_FromStringAndSize("XXH3_128", sizeof("XXH3_128"));
15321533
}
15331534

15341535
static PyObject *
@@ -1553,7 +1554,7 @@ static PyGetSetDef PYXXH3_128_getseters[] = {
15531554
{
15541555
"name",
15551556
(getter)PYXXH3_128_get_name, NULL,
1556-
"Name. Always XXH3_64.",
1557+
"Name. Always XXH3_128.",
15571558
NULL
15581559
},
15591560
{
@@ -1582,7 +1583,7 @@ PyDoc_STRVAR(
15821583
"digest() -- return the current digest value\n"
15831584
"hexdigest() -- return the current digest as a string of hexadecimal digits\n"
15841585
"intdigest() -- return the current digest as an integer\n"
1585-
"copy() -- return a copy of the current xxh64 object");
1586+
"copy() -- return a copy of the current xxh3_128 object");
15861587

15871588
static PyTypeObject PYXXH3_128Type = {
15881589
#if PY_MAJOR_VERSION >= 3

0 commit comments

Comments
 (0)