[Python-checkins] Use Py_NewRef in Modules/_struct.c (GH-23981)
pablogsal
webhook-mailer at python.org
Mon Dec 28 18:59:30 EST 2020
https://github.com/python/cpython/commit/290f5ae9977488d0faa0890d596aeed88e97355f
commit: 290f5ae9977488d0faa0890d596aeed88e97355f
branch: master
author: Pablo Galindo <Pablogsal at gmail.com>
committer: pablogsal <Pablogsal at gmail.com>
date: 2020-12-28T23:59:16Z
summary:
Use Py_NewRef in Modules/_struct.c (GH-23981)
files:
M Modules/_struct.c
diff --git a/Modules/_struct.c b/Modules/_struct.c
index c95c76f8ae039..1a5e0ae28e876 100644
--- a/Modules/_struct.c
+++ b/Modules/_struct.c
@@ -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;
More information about the Python-checkins
mailing list