From 9cca88971313a4d2b2b3fda537f463dea6b55391 Mon Sep 17 00:00:00 2001 From: Donghee Na Date: Sat, 20 Apr 2024 09:54:50 +0900 Subject: [PATCH] Address code review --- Objects/setobject.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Objects/setobject.c b/Objects/setobject.c index 04788ff197d9c0..88ce42c0e3f3f2 100644 --- a/Objects/setobject.c +++ b/Objects/setobject.c @@ -2334,7 +2334,8 @@ set_init(PySetObject *self, PyObject *args, PyObject *kwds) if (!PyArg_UnpackTuple(args, Py_TYPE(self)->tp_name, 0, 1, &iterable)) return -1; - if (self->fill == 0 && Py_REFCNT(self) == 1) { + if (Py_REFCNT(self) == 1 && self->fill == 0) { + self->hash = -1; if (iterable == NULL) { return 0; }