]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-114414: Assert PyType_GetModuleByDef result in _threadmodule (#114415)
authorNikita Sobolev <mail@sobolevn.me>
Mon, 22 Jan 2024 09:19:25 +0000 (12:19 +0300)
committerGitHub <noreply@github.com>
Mon, 22 Jan 2024 09:19:25 +0000 (10:19 +0100)
Modules/_threadmodule.c

index afcf646e3bc19e1061e8dbb3f68976d9c669c3af..99f97eb6d0adccef8f05fa7afca7f91e6306d4bb 100644 (file)
@@ -901,6 +901,7 @@ local_new(PyTypeObject *type, PyObject *args, PyObject *kw)
     }
 
     PyObject *module = PyType_GetModuleByDef(type, &thread_module);
+    assert(module != NULL);
     thread_module_state *state = get_thread_state(module);
 
     localobject *self = (localobject *)type->tp_alloc(type, 0);
@@ -1042,6 +1043,7 @@ static int
 local_setattro(localobject *self, PyObject *name, PyObject *v)
 {
     PyObject *module = PyType_GetModuleByDef(Py_TYPE(self), &thread_module);
+    assert(module != NULL);
     thread_module_state *state = get_thread_state(module);
 
     PyObject *ldict = _ldict(self, state);
@@ -1094,6 +1096,7 @@ static PyObject *
 local_getattro(localobject *self, PyObject *name)
 {
     PyObject *module = PyType_GetModuleByDef(Py_TYPE(self), &thread_module);
+    assert(module != NULL);
     thread_module_state *state = get_thread_state(module);
 
     PyObject *ldict = _ldict(self, state);