https://github.com/python/cpython/commit/d1b031cc58516e1aba823fd613528417a996f50d
commit: d1b031cc58516e1aba823fd613528417a996f50d
branch: main
author: Nikita Sobolev <[email protected]>
committer: erlend-aasland <[email protected]>
date: 2024-01-22T10:19:25+01:00
summary:

gh-114414: Assert PyType_GetModuleByDef result in _threadmodule (#114415)

files:
M Modules/_threadmodule.c

diff --git a/Modules/_threadmodule.c b/Modules/_threadmodule.c
index afcf646e3bc19e..99f97eb6d0adcc 100644
--- a/Modules/_threadmodule.c
+++ b/Modules/_threadmodule.c
@@ -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);

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-checkins.python.org/
Member address: [email protected]

Reply via email to