From efd71aad4f22ec0073d80b8dd296015d3f395aa8 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 10 Nov 2020 09:39:42 +1100 Subject: Cleanup: clang-tidy suppress warnings for PyTypeObject.tp_print Clang-tidy behavior changes from Python 3.7 to 3.8+ so it's simplest to suppress the warning in this instance. --- source/blender/freestyle/intern/python/Interface1D/BPy_FrsCurve.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'source/blender/freestyle/intern/python/Interface1D/BPy_FrsCurve.cpp') diff --git a/source/blender/freestyle/intern/python/Interface1D/BPy_FrsCurve.cpp b/source/blender/freestyle/intern/python/Interface1D/BPy_FrsCurve.cpp index 4fedbcf1513..e41e16c7b8d 100644 --- a/source/blender/freestyle/intern/python/Interface1D/BPy_FrsCurve.cpp +++ b/source/blender/freestyle/intern/python/Interface1D/BPy_FrsCurve.cpp @@ -190,6 +190,8 @@ PyTypeObject FrsCurve_Type = { sizeof(BPy_FrsCurve), /* tp_basicsize */ 0, /* tp_itemsize */ nullptr, /* tp_dealloc */ + /* Incompatible with Python3.8+ (deprecated function). + * NOLINTNEXTLINE: modernize-use-nullptr. */ 0, /* tp_print */ nullptr, /* tp_getattr */ nullptr, /* tp_setattr */ -- cgit v1.2.3 From b5d310b569e07a937798a2d38539cfd290149f1c Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 10 Nov 2020 09:42:03 +1100 Subject: Cleanup: clang-format --- .../intern/python/Interface1D/BPy_FrsCurve.cpp | 66 +++++++++++----------- 1 file changed, 33 insertions(+), 33 deletions(-) (limited to 'source/blender/freestyle/intern/python/Interface1D/BPy_FrsCurve.cpp') diff --git a/source/blender/freestyle/intern/python/Interface1D/BPy_FrsCurve.cpp b/source/blender/freestyle/intern/python/Interface1D/BPy_FrsCurve.cpp index e41e16c7b8d..4420ce02ced 100644 --- a/source/blender/freestyle/intern/python/Interface1D/BPy_FrsCurve.cpp +++ b/source/blender/freestyle/intern/python/Interface1D/BPy_FrsCurve.cpp @@ -192,39 +192,39 @@ PyTypeObject FrsCurve_Type = { nullptr, /* tp_dealloc */ /* Incompatible with Python3.8+ (deprecated function). * NOLINTNEXTLINE: modernize-use-nullptr. */ - 0, /* tp_print */ - nullptr, /* tp_getattr */ - nullptr, /* tp_setattr */ - nullptr, /* tp_reserved */ - nullptr, /* tp_repr */ - nullptr, /* tp_as_number */ - nullptr, /* tp_as_sequence */ - nullptr, /* tp_as_mapping */ - nullptr, /* tp_hash */ - nullptr, /* tp_call */ - nullptr, /* tp_str */ - nullptr, /* tp_getattro */ - nullptr, /* tp_setattro */ - nullptr, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - FrsCurve_doc, /* tp_doc */ - nullptr, /* tp_traverse */ - nullptr, /* tp_clear */ - nullptr, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - nullptr, /* tp_iter */ - nullptr, /* tp_iternext */ - BPy_FrsCurve_methods, /* tp_methods */ - nullptr, /* tp_members */ - BPy_FrsCurve_getseters, /* tp_getset */ - &Interface1D_Type, /* tp_base */ - nullptr, /* tp_dict */ - nullptr, /* tp_descr_get */ - nullptr, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)FrsCurve_init, /* tp_init */ - nullptr, /* tp_alloc */ - nullptr, /* tp_new */ + 0, /* tp_print */ + nullptr, /* tp_getattr */ + nullptr, /* tp_setattr */ + nullptr, /* tp_reserved */ + nullptr, /* tp_repr */ + nullptr, /* tp_as_number */ + nullptr, /* tp_as_sequence */ + nullptr, /* tp_as_mapping */ + nullptr, /* tp_hash */ + nullptr, /* tp_call */ + nullptr, /* tp_str */ + nullptr, /* tp_getattro */ + nullptr, /* tp_setattro */ + nullptr, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + FrsCurve_doc, /* tp_doc */ + nullptr, /* tp_traverse */ + nullptr, /* tp_clear */ + nullptr, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + nullptr, /* tp_iter */ + nullptr, /* tp_iternext */ + BPy_FrsCurve_methods, /* tp_methods */ + nullptr, /* tp_members */ + BPy_FrsCurve_getseters, /* tp_getset */ + &Interface1D_Type, /* tp_base */ + nullptr, /* tp_dict */ + nullptr, /* tp_descr_get */ + nullptr, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)FrsCurve_init, /* tp_init */ + nullptr, /* tp_alloc */ + nullptr, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// -- cgit v1.2.3 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. --- .../blender/freestyle/intern/python/Interface1D/BPy_FrsCurve.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'source/blender/freestyle/intern/python/Interface1D/BPy_FrsCurve.cpp') diff --git a/source/blender/freestyle/intern/python/Interface1D/BPy_FrsCurve.cpp b/source/blender/freestyle/intern/python/Interface1D/BPy_FrsCurve.cpp index 4420ce02ced..d77a8007b1a 100644 --- a/source/blender/freestyle/intern/python/Interface1D/BPy_FrsCurve.cpp +++ b/source/blender/freestyle/intern/python/Interface1D/BPy_FrsCurve.cpp @@ -190,9 +190,11 @@ PyTypeObject FrsCurve_Type = { sizeof(BPy_FrsCurve), /* 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