comparison contrib/python-zstandard/c-ext/decompressor.c @ 46374:e92ca942ddca

cext: add Python 3.10 support * Replace "Py_TYPE(obj) = type;" with "Py_SET_TYPE(obj, type);" * Add pythoncapi_compat.h header file to get Py_SET_TYPE() on Python 2.7-3.8. Header file added to mercurial/ and contrib/python-zstandard/zstd/common/. In Python 3.10, Py_TYPE(obj) must not longer be used as an l-value. pythoncapi_compat.h comes from: https://github.com/pythoncapi/pythoncapi_compat Differential Revision: https://phab.mercurial-scm.org/D9825
author Victor Stinner <vstinner@python.org>
date Mon, 14 Dec 2020 10:44:29 +0100
parents a4e32fd539ab
children
comparison
equal deleted inserted replaced
46373:711ba0f1057e 46374:e92ca942ddca
1809 0, /* tp_alloc */ 1809 0, /* tp_alloc */
1810 PyType_GenericNew, /* tp_new */ 1810 PyType_GenericNew, /* tp_new */
1811 }; 1811 };
1812 1812
1813 void decompressor_module_init(PyObject* mod) { 1813 void decompressor_module_init(PyObject* mod) {
1814 Py_TYPE(&ZstdDecompressorType) = &PyType_Type; 1814 Py_SET_TYPE(&ZstdDecompressorType, &PyType_Type);
1815 if (PyType_Ready(&ZstdDecompressorType) < 0) { 1815 if (PyType_Ready(&ZstdDecompressorType) < 0) {
1816 return; 1816 return;
1817 } 1817 }
1818 1818
1819 Py_INCREF((PyObject*)&ZstdDecompressorType); 1819 Py_INCREF((PyObject*)&ZstdDecompressorType);