closes bpo-34477: Objects/typeobject.c: Add missing NULL check to type_init() (GH-8876)

Reported by Svace static analyzer.
(cherry picked from commit f6247aac08)

Co-authored-by: Alexey Izbyshev <izbyshev@ispras.ru>
This commit is contained in:
Miss Islington (bot) 2018-08-24 00:38:16 -04:00 committed by GitHub
parent 1d3d688b98
commit 609062a23f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 0 deletions

View File

@ -2295,6 +2295,9 @@ type_init(PyObject *cls, PyObject *args, PyObject *kwds)
/* Call object.__init__(self) now. */
/* XXX Could call super(type, cls).__init__() but what's the point? */
args = PyTuple_GetSlice(args, 0, 0);
if (args == NULL) {
return -1;
}
res = object_init(cls, args, NULL);
Py_DECREF(args);
return res;