Mercurial > hg
comparison mercurial/cext/osutil.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 | f93a4e3d35ab |
children | d4ba4d51f85f |
comparison
equal
deleted
inserted
replaced
46373:711ba0f1057e | 46374:e92ca942ddca |
---|---|
117 return t->tp_alloc(t, 0); | 117 return t->tp_alloc(t, 0); |
118 } | 118 } |
119 | 119 |
120 static void listdir_stat_dealloc(PyObject *o) | 120 static void listdir_stat_dealloc(PyObject *o) |
121 { | 121 { |
122 o->ob_type->tp_free(o); | 122 Py_TYPE(o)->tp_free(o); |
123 } | 123 } |
124 | 124 |
125 static PyObject *listdir_stat_getitem(PyObject *self, PyObject *key) | 125 static PyObject *listdir_stat_getitem(PyObject *self, PyObject *key) |
126 { | 126 { |
127 long index = PyLong_AsLong(key); | 127 long index = PyLong_AsLong(key); |