mirror of
https://github.com/python/cpython.git
synced 2025-12-04 16:43:27 +00:00
gh-114414: Assert PyType_GetModuleByDef result in _threadmodule (#114415)
This commit is contained in:
parent
650f9e4c94
commit
d1b031cc58
1 changed files with 3 additions and 0 deletions
|
|
@ -901,6 +901,7 @@ local_new(PyTypeObject *type, PyObject *args, PyObject *kw)
|
||||||
}
|
}
|
||||||
|
|
||||||
PyObject *module = PyType_GetModuleByDef(type, &thread_module);
|
PyObject *module = PyType_GetModuleByDef(type, &thread_module);
|
||||||
|
assert(module != NULL);
|
||||||
thread_module_state *state = get_thread_state(module);
|
thread_module_state *state = get_thread_state(module);
|
||||||
|
|
||||||
localobject *self = (localobject *)type->tp_alloc(type, 0);
|
localobject *self = (localobject *)type->tp_alloc(type, 0);
|
||||||
|
|
@ -1042,6 +1043,7 @@ static int
|
||||||
local_setattro(localobject *self, PyObject *name, PyObject *v)
|
local_setattro(localobject *self, PyObject *name, PyObject *v)
|
||||||
{
|
{
|
||||||
PyObject *module = PyType_GetModuleByDef(Py_TYPE(self), &thread_module);
|
PyObject *module = PyType_GetModuleByDef(Py_TYPE(self), &thread_module);
|
||||||
|
assert(module != NULL);
|
||||||
thread_module_state *state = get_thread_state(module);
|
thread_module_state *state = get_thread_state(module);
|
||||||
|
|
||||||
PyObject *ldict = _ldict(self, state);
|
PyObject *ldict = _ldict(self, state);
|
||||||
|
|
@ -1094,6 +1096,7 @@ static PyObject *
|
||||||
local_getattro(localobject *self, PyObject *name)
|
local_getattro(localobject *self, PyObject *name)
|
||||||
{
|
{
|
||||||
PyObject *module = PyType_GetModuleByDef(Py_TYPE(self), &thread_module);
|
PyObject *module = PyType_GetModuleByDef(Py_TYPE(self), &thread_module);
|
||||||
|
assert(module != NULL);
|
||||||
thread_module_state *state = get_thread_state(module);
|
thread_module_state *state = get_thread_state(module);
|
||||||
|
|
||||||
PyObject *ldict = _ldict(self, state);
|
PyObject *ldict = _ldict(self, state);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue