]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Use Py_NewRef in Modules/_struct.c (GH-23981)
authorPablo Galindo <Pablogsal@gmail.com>
Mon, 28 Dec 2020 23:59:16 +0000 (23:59 +0000)
committerGitHub <noreply@github.com>
Mon, 28 Dec 2020 23:59:16 +0000 (23:59 +0000)
Modules/_struct.c

index c95c76f8ae039e8581080d729012ac6e3c2cc8e4..1a5e0ae28e876b746aacc7bc0b42ff2009ef9d3c 100644 (file)
@@ -1442,8 +1442,7 @@ s_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
     self = alloc_func(type, 0);
     if (self != NULL) {
         PyStructObject *s = (PyStructObject*)self;
-        Py_INCREF(Py_None);
-        s->s_format = Py_None;
+        s->s_format = Py_NewRef(Py_None);
         s->s_codes = NULL;
         s->s_size = -1;
         s->s_len = -1;