Fix: Build error with MSVC

This reverts part of d594954bf2 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.
This commit is contained in:
Ray Molenkamp
2023-07-16 11:29:50 -06:00
parent caf0024463
commit 95367f732f

View File

@@ -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,