diff options
author | Tomas Hrnciar <thrnciar@redhat.com> | 2020-11-06 12:25:38 +0100 |
---|---|---|
committer | Christoph Reiter <reiter.christoph@gmail.com> | 2020-11-11 10:09:10 +0100 |
commit | ba67301beea4b4a7a19485f68215b0f0d52888be (patch) | |
tree | e65d66e7d0129a9f683d80c8ecf1e74d6724b83e /gi/pygi-util.h | |
parent | c28e4da87ab9411baa081c47e67574a1ea059493 (diff) | |
download | pygobject-ba67301beea4b4a7a19485f68215b0f0d52888be.tar.gz |
Don't assume Py_TYPE being a macro
Py_TYPE was changed to a function in Python 3.10. Suggested approach is
to use Py_SET_TYPE macro instead, see:
https://docs.python.org/3.10/whatsnew/3.10.html.
Diffstat (limited to 'gi/pygi-util.h')
-rw-r--r-- | gi/pygi-util.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/gi/pygi-util.h b/gi/pygi-util.h index f67ca8a8..5a3becf4 100644 --- a/gi/pygi-util.h +++ b/gi/pygi-util.h @@ -12,6 +12,10 @@ const gchar * pyg_constant_strip_prefix(const gchar *name, const gchar *strip_pr gboolean pygi_guint_from_pyssize (Py_ssize_t pyval, guint *result); +#if PY_VERSION_HEX < 0x030900A4 +# define Py_SET_TYPE(obj, type) ((Py_TYPE(obj) = (type)), (void)0) +#endif + #define PYGI_DEFINE_TYPE(typename, symbol, csymbol) \ PyTypeObject symbol = { \ PyVarObject_HEAD_INIT(NULL, 0) \ |