浏览代码

app_python3: use Py_SET_TYPE() from python 3.9

Daniel-Constantin Mierla 2 年之前
父节点
当前提交
fc75b4c3f8
共有 1 个文件被更改,包括 4 次插入0 次删除
  1. 4 0
      src/modules/app_python3/python_msgobj.c

+ 4 - 0
src/modules/app_python3/python_msgobj.c

@@ -507,7 +507,11 @@ static PyTypeObject MSGtype = {
 
 int python_msgobj_init(void)
 {
+#if PY_VERSION_HEX >= 0x03090000
+	Py_SET_TYPE(&MSGtype, &PyType_Type);
+#else
 	Py_TYPE(&MSGtype) = &PyType_Type;
+#endif
 	if (PyType_Ready(&MSGtype) < 0)
 		return -1;
 	return 0;