From 1cf286d54b02d77631702237209997e99670354e Mon Sep 17 00:00:00 2001 From: Stan Ulbrych Date: Mon, 19 May 2025 10:58:07 +0100 Subject: [PATCH 1/7] Fix compiler warning --- Python/ceval.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Python/ceval.c b/Python/ceval.c index 490b653f132a6a..aff4482ebd3841 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -1863,7 +1863,7 @@ _PyEvalFramePushAndInit_Ex(PyThreadState *tstate, _PyStackRef func, { bool has_dict = (kwargs != NULL && PyDict_GET_SIZE(kwargs) > 0); PyObject *kwnames = NULL; - _PyStackRef *newargs; + _PyStackRef *newargs = NULL; PyObject *const *object_array = NULL; _PyStackRef stack_array[8]; if (has_dict) { @@ -1904,7 +1904,7 @@ _PyEvalFramePushAndInit_Ex(PyThreadState *tstate, _PyStackRef func, _PyStack_UnpackDict_FreeNoDecRef(object_array, kwnames); } else if (nargs > 8) { - PyMem_Free((void *)newargs); + PyMem_Free((void *)newargs); } /* No need to decref func here because the reference has been stolen by _PyEvalFramePushAndInit. From e626f0a4219b6a7b8cd0ea9a39d5a0f583b478e5 Mon Sep 17 00:00:00 2001 From: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com> Date: Thu, 19 Jun 2025 16:25:49 +0100 Subject: [PATCH 2/7] Ignore instead --- Python/ceval.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Python/ceval.c b/Python/ceval.c index aff4482ebd3841..11b54e5b6bb0b9 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -1863,8 +1863,11 @@ _PyEvalFramePushAndInit_Ex(PyThreadState *tstate, _PyStackRef func, { bool has_dict = (kwargs != NULL && PyDict_GET_SIZE(kwargs) > 0); PyObject *kwnames = NULL; - _PyStackRef *newargs = NULL; + _PyStackRef *newargs; PyObject *const *object_array = NULL; + #elif defined(__clang__) + #pragma clang diagnostic ignored "-Wmaybe-uninitialized" + #endif _PyStackRef stack_array[8]; if (has_dict) { object_array = _PyStack_UnpackDict(tstate, _PyTuple_ITEMS(callargs), nargs, kwargs, &kwnames); @@ -1906,6 +1909,9 @@ _PyEvalFramePushAndInit_Ex(PyThreadState *tstate, _PyStackRef func, else if (nargs > 8) { PyMem_Free((void *)newargs); } + #elif defined(__clang__) + #pragma clang diagnostic pop + #endif /* No need to decref func here because the reference has been stolen by _PyEvalFramePushAndInit. */ From 6ee130fccfb1d1b1cdb2629252dd70815a91ee34 Mon Sep 17 00:00:00 2001 From: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com> Date: Thu, 19 Jun 2025 16:31:45 +0100 Subject: [PATCH 3/7] Fixup --- Python/ceval.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Python/ceval.c b/Python/ceval.c index 11b54e5b6bb0b9..ddd2dbd914cb54 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -1865,7 +1865,7 @@ _PyEvalFramePushAndInit_Ex(PyThreadState *tstate, _PyStackRef func, PyObject *kwnames = NULL; _PyStackRef *newargs; PyObject *const *object_array = NULL; - #elif defined(__clang__) + #if defined(__clang__) #pragma clang diagnostic ignored "-Wmaybe-uninitialized" #endif _PyStackRef stack_array[8]; @@ -1909,7 +1909,7 @@ _PyEvalFramePushAndInit_Ex(PyThreadState *tstate, _PyStackRef func, else if (nargs > 8) { PyMem_Free((void *)newargs); } - #elif defined(__clang__) + #if defined(__clang__) #pragma clang diagnostic pop #endif /* No need to decref func here because the reference has been stolen by From 989db0f4a9ed3a659ba6b7aa31509a7b44433194 Mon Sep 17 00:00:00 2001 From: Stan Ulbrych Date: Thu, 19 Jun 2025 20:59:38 +0100 Subject: [PATCH 4/7] Switchup --- Python/ceval.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Python/ceval.c b/Python/ceval.c index ddd2dbd914cb54..4a33bcec68d2a8 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -1865,7 +1865,7 @@ _PyEvalFramePushAndInit_Ex(PyThreadState *tstate, _PyStackRef func, PyObject *kwnames = NULL; _PyStackRef *newargs; PyObject *const *object_array = NULL; - #if defined(__clang__) + #if defined(__GNUC__) #pragma clang diagnostic ignored "-Wmaybe-uninitialized" #endif _PyStackRef stack_array[8]; @@ -1909,7 +1909,7 @@ _PyEvalFramePushAndInit_Ex(PyThreadState *tstate, _PyStackRef func, else if (nargs > 8) { PyMem_Free((void *)newargs); } - #if defined(__clang__) + #if defined(__GNUC__) #pragma clang diagnostic pop #endif /* No need to decref func here because the reference has been stolen by From 67b70c1ccdc9e0ca6b72d037856249c7d10f5c41 Mon Sep 17 00:00:00 2001 From: Stan Ulbrych Date: Thu, 19 Jun 2025 21:00:22 +0100 Subject: [PATCH 5/7] Complete Switchup --- Python/ceval.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Python/ceval.c b/Python/ceval.c index 4a33bcec68d2a8..531aca27827065 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -1866,7 +1866,7 @@ _PyEvalFramePushAndInit_Ex(PyThreadState *tstate, _PyStackRef func, _PyStackRef *newargs; PyObject *const *object_array = NULL; #if defined(__GNUC__) - #pragma clang diagnostic ignored "-Wmaybe-uninitialized" + #pragma GCC diagnostic ignored "-Wmaybe-uninitialized" #endif _PyStackRef stack_array[8]; if (has_dict) { @@ -1910,7 +1910,7 @@ _PyEvalFramePushAndInit_Ex(PyThreadState *tstate, _PyStackRef func, PyMem_Free((void *)newargs); } #if defined(__GNUC__) - #pragma clang diagnostic pop + #pragma GCC diagnostic pop #endif /* No need to decref func here because the reference has been stolen by _PyEvalFramePushAndInit. From 673a5c3cfdd74afdb3cda7f30f5bf20df0f1efd1 Mon Sep 17 00:00:00 2001 From: Stan Ulbrych Date: Thu, 19 Jun 2025 21:07:04 +0100 Subject: [PATCH 6/7] Move/push --- Python/ceval.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Python/ceval.c b/Python/ceval.c index 531aca27827065..ad9eea09e7ac67 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -1866,9 +1866,13 @@ _PyEvalFramePushAndInit_Ex(PyThreadState *tstate, _PyStackRef func, _PyStackRef *newargs; PyObject *const *object_array = NULL; #if defined(__GNUC__) + #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wmaybe-uninitialized" #endif _PyStackRef stack_array[8]; + #if defined(__GNUC__) + #pragma GCC diagnostic pop + #endif if (has_dict) { object_array = _PyStack_UnpackDict(tstate, _PyTuple_ITEMS(callargs), nargs, kwargs, &kwnames); if (object_array == NULL) { @@ -1909,9 +1913,6 @@ _PyEvalFramePushAndInit_Ex(PyThreadState *tstate, _PyStackRef func, else if (nargs > 8) { PyMem_Free((void *)newargs); } - #if defined(__GNUC__) - #pragma GCC diagnostic pop - #endif /* No need to decref func here because the reference has been stolen by _PyEvalFramePushAndInit. */ From dbe8238498f3a82346bceca93f5509eeb8c2cd68 Mon Sep 17 00:00:00 2001 From: Stan Ulbrych Date: Thu, 19 Jun 2025 21:28:08 +0100 Subject: [PATCH 7/7] Not clang --- Python/ceval.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Python/ceval.c b/Python/ceval.c index ad9eea09e7ac67..7a2f12135ec9a5 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -1865,12 +1865,12 @@ _PyEvalFramePushAndInit_Ex(PyThreadState *tstate, _PyStackRef func, PyObject *kwnames = NULL; _PyStackRef *newargs; PyObject *const *object_array = NULL; - #if defined(__GNUC__) + #if defined(__GNUC__) && !defined(__clang__) #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wmaybe-uninitialized" #endif _PyStackRef stack_array[8]; - #if defined(__GNUC__) + #if defined(__GNUC__) && !defined(__clang__) #pragma GCC diagnostic pop #endif if (has_dict) {