summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorMark Shannon <mark@hotpy.org>2022-03-03 10:38:27 (GMT)
committerGitHub <noreply@github.com>2022-03-03 10:38:27 (GMT)
commit751c9ed801ad1189272ca10f0749bfc9d49b5038 (patch)
treedb17f40d13eadfade31e3133463954c86fe9d6e2 /Objects
parent3c4abfab0d3e2a3b1e626a5eb185ad1f5436b532 (diff)
downloadcpython-751c9ed801ad1189272ca10f0749bfc9d49b5038.zip
cpython-751c9ed801ad1189272ca10f0749bfc9d49b5038.tar.gz
cpython-751c9ed801ad1189272ca10f0749bfc9d49b5038.tar.bz2
bpo-46891: Fix creating a new instance of a module subclass with slots (GH-31643)
Diffstat (limited to 'Objects')
-rw-r--r--Objects/moduleobject.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/Objects/moduleobject.c b/Objects/moduleobject.c
index 72ed9bb..738b262 100644
--- a/Objects/moduleobject.c
+++ b/Objects/moduleobject.c
@@ -4,6 +4,7 @@
#include "Python.h"
#include "pycore_call.h" // _PyObject_CallNoArgs()
#include "pycore_interp.h" // PyInterpreterState.importlib
+#include "pycore_object.h" // _PyType_AllocNoTrack
#include "pycore_pystate.h" // _PyInterpreterState_GET()
#include "pycore_moduleobject.h" // _PyModule_GetDef()
#include "structmember.h" // PyMemberDef
@@ -80,7 +81,7 @@ static PyModuleObject *
new_module_notrack(PyTypeObject *mt)
{
PyModuleObject *m;
- m = PyObject_GC_New(PyModuleObject, mt);
+ m = (PyModuleObject *)_PyType_AllocNoTrack(mt, 0);
if (m == NULL)
return NULL;
m->md_def = NULL;