diff options
author | Campbell Barton <ideasman42@gmail.com> | 2020-11-11 00:36:54 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2020-11-11 01:11:21 +0300 |
commit | cd9acfed4f7674b84be965d469a367aef96f8af3 (patch) | |
tree | 2b0d8785ffe57874576157261eb007d3731b5a35 /source/blender/python/generic/idprop_py_api.c | |
parent | 86bdd2acc66c95c3698525ab3d5d6263cc1b825c (diff) |
Cleanup: use preprocessor version check for PyTypeObject declaration
While `tp_print` was deprecated, Python 3.8+ uses this for
'tp_vectorcall_offset' which wasn't stated in the comment from
efd71aad4f22ec0073d80b8dd296015d3f395aa8.
Instead of suppressing clang-tidy, use preprocessor a check since
this properly represents the difference between Python versions.
Diffstat (limited to 'source/blender/python/generic/idprop_py_api.c')
-rw-r--r-- | source/blender/python/generic/idprop_py_api.c | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/source/blender/python/generic/idprop_py_api.c b/source/blender/python/generic/idprop_py_api.c index 6f5f36ec42f..38191ffc8bd 100644 --- a/source/blender/python/generic/idprop_py_api.c +++ b/source/blender/python/generic/idprop_py_api.c @@ -1198,7 +1198,11 @@ PyTypeObject BPy_IDGroup_Type = { /* Methods to implement standard operations */ NULL, /* destructor tp_dealloc; */ - (printfunc)NULL, /* printfunc tp_print; */ +#if PY_VERSION_HEX >= 0x03080000 + 0, /* tp_vectorcall_offset */ +#else + (printfunc)NULL, /* printfunc tp_print */ +#endif NULL, /* getattrfunc tp_getattr; */ NULL, /* setattrfunc tp_setattr; */ NULL, /* cmpfunc tp_compare; */ @@ -1607,7 +1611,11 @@ PyTypeObject BPy_IDArray_Type = { /* Methods to implement standard operations */ NULL, /* destructor tp_dealloc; */ - (printfunc)NULL, /* printfunc tp_print; */ +#if PY_VERSION_HEX >= 0x03080000 + 0, /* tp_vectorcall_offset */ +#else + (printfunc)NULL, /* printfunc tp_print */ +#endif NULL, /* getattrfunc tp_getattr; */ NULL, /* setattrfunc tp_setattr; */ NULL, /* cmpfunc tp_compare; */ @@ -1724,7 +1732,11 @@ PyTypeObject BPy_IDGroup_Iter_Type = { /* Methods to implement standard operations */ NULL, /* destructor tp_dealloc; */ - (printfunc)NULL, /* printfunc tp_print; */ +#if PY_VERSION_HEX >= 0x03080000 + 0, /* tp_vectorcall_offset */ +#else + (printfunc)NULL, /* printfunc tp_print */ +#endif NULL, /* getattrfunc tp_getattr; */ NULL, /* setattrfunc tp_setattr; */ NULL, /* cmpfunc tp_compare; */ |