From 7a36efc4b82612939b9e1c7c7651aa3792399caf Mon Sep 17 00:00:00 2001 From: Bertrand Bellenot Date: Tue, 7 Jul 2026 09:50:08 +0200 Subject: [PATCH 1/2] [asan] Fix argv array for PyROOT applications pick these changes from https://github.com/root-project/root/pull/22746: - The argv array for PyROOT applications was one element too small This fixes 20 failing pyunittests on Windows. Thanks @hageboeck! --- bindings/pyroot/pythonizations/src/RPyROOTApplication.cxx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/bindings/pyroot/pythonizations/src/RPyROOTApplication.cxx b/bindings/pyroot/pythonizations/src/RPyROOTApplication.cxx index 67f11364399e3..6be2f786898f9 100644 --- a/bindings/pyroot/pythonizations/src/RPyROOTApplication.cxx +++ b/bindings/pyroot/pythonizations/src/RPyROOTApplication.cxx @@ -46,7 +46,8 @@ bool PyROOT::RPyROOTApplication::CreateApplication(int ignoreCmdLineOpts) char **argv = nullptr; if (ignoreCmdLineOpts) { - argv = new char *[argc]; + // Last argv must be null (see https://en.cppreference.com/cpp/language/main_function) + argv = new char *[argc + 1]{}; } else { // Retrieve sys.argv list from Python PyObject *argl = PySys_GetObject("argv"); @@ -57,7 +58,8 @@ bool PyROOT::RPyROOTApplication::CreateApplication(int ignoreCmdLineOpts) argc = static_cast(size); } - argv = new char *[argc]; + // Last argv must be null (see https://en.cppreference.com/cpp/language/main_function) + argv = new char *[argc + 1]{}; for (int i = 1; i < argc; ++i) { PyObject *item = PyList_GetItem(argl, i); From 2d2da109d86231ce86659e2be43797bad6dde781 Mon Sep 17 00:00:00 2001 From: Bertrand Bellenot Date: Tue, 7 Jul 2026 16:23:11 +0200 Subject: [PATCH 2/2] clang-format --- bindings/pyroot/pythonizations/src/RPyROOTApplication.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bindings/pyroot/pythonizations/src/RPyROOTApplication.cxx b/bindings/pyroot/pythonizations/src/RPyROOTApplication.cxx index 6be2f786898f9..48fa9b8dc9bea 100644 --- a/bindings/pyroot/pythonizations/src/RPyROOTApplication.cxx +++ b/bindings/pyroot/pythonizations/src/RPyROOTApplication.cxx @@ -47,7 +47,7 @@ bool PyROOT::RPyROOTApplication::CreateApplication(int ignoreCmdLineOpts) if (ignoreCmdLineOpts) { // Last argv must be null (see https://en.cppreference.com/cpp/language/main_function) - argv = new char *[argc + 1]{}; + argv = new char *[argc + 1] {}; } else { // Retrieve sys.argv list from Python PyObject *argl = PySys_GetObject("argv"); @@ -59,7 +59,7 @@ bool PyROOT::RPyROOTApplication::CreateApplication(int ignoreCmdLineOpts) } // Last argv must be null (see https://en.cppreference.com/cpp/language/main_function) - argv = new char *[argc + 1]{}; + argv = new char *[argc + 1] {}; for (int i = 1; i < argc; ++i) { PyObject *item = PyList_GetItem(argl, i);