From cd9acfed4f7674b84be965d469a367aef96f8af3 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 11 Nov 2020 08:36:54 +1100 Subject: 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. --- .../UnaryFunction0D/UnaryFunction0D_float/BPy_GetParameterF0D.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_GetParameterF0D.cpp') diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_GetParameterF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_GetParameterF0D.cpp index ba5d7e641e7..d4c735e3572 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_GetParameterF0D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_GetParameterF0D.cpp @@ -66,9 +66,11 @@ PyTypeObject GetParameterF0D_Type = { sizeof(BPy_GetParameterF0D), /* tp_basicsize */ 0, /* tp_itemsize */ nullptr, /* tp_dealloc */ - /* Incompatible with Python3.8+ (deprecated function). - * NOLINTNEXTLINE: modernize-use-nullptr. */ - 0, /* tp_print */ +#if PY_VERSION_HEX >= 0x03080000 + 0, /* tp_vectorcall_offset */ +#else + nullptr, /* tp_print */ +#endif nullptr, /* tp_getattr */ nullptr, /* tp_setattr */ nullptr, /* tp_reserved */ -- cgit v1.2.3