From 95367f732fc0cef49a3cec9674f6ec2ac61cda09 Mon Sep 17 00:00:00 2001 From: Ray Molenkamp Date: Sun, 16 Jul 2023 11:29:50 -0600 Subject: [PATCH] Fix: Build error with MSVC This reverts part of d594954bf224 as the MSVC preprocessor does not enjoy nested `#if` statements inside macro parameters leading to a build error. Neither GCC nor MSVC is correct or wrong here as the C99 standard has this to say on the subject: "If there are sequences of preprocessing tokens within the list of arguments that would otherwise act as preprocessing directives, the behaviour is undefined" source: C99 - 6.10.3.11 (Macro replacement) Worth noting C++17 has identical language inside the cpp.replace section of the standard. Given this is undefined behaviour for both C99 and C++17, best not to rely on it. --- source/blender/python/intern/bpy_app_handlers.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/source/blender/python/intern/bpy_app_handlers.c b/source/blender/python/intern/bpy_app_handlers.c index a98c2423061..db869555ba0 100644 --- a/source/blender/python/intern/bpy_app_handlers.c +++ b/source/blender/python/intern/bpy_app_handlers.c @@ -154,13 +154,11 @@ static PyObject *bpy_app_handlers_persistent_new(PyTypeObject *UNUSED(type), /** Dummy type because decorators can't be a #PyCFunction. */ static PyTypeObject BPyPersistent_Type = { - /*ob_base*/ PyVarObject_HEAD_INIT( #if defined(_MSC_VER) - NULL, + /*ob_base*/ PyVarObject_HEAD_INIT(NULL, 0) #else - &PyType_Type, + /*ob_base*/ PyVarObject_HEAD_INIT(&PyType_Type, 0) #endif - 0) /*tp_name*/ "persistent", /*tp_basicsize*/ 0, /*tp_itemsize*/ 0,