From e50a4752263ef44780655322eeea8d4532551730 Mon Sep 17 00:00:00 2001 From: wmayer Date: Sun, 20 Mar 2022 13:39:22 +0100 Subject: [PATCH] Base: [skip ci] cleaning up modules is only needed for leak detectors --- src/Base/Interpreter.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Base/Interpreter.cpp b/src/Base/Interpreter.cpp index 10196e5650..3de634ce05 100644 --- a/src/Base/Interpreter.cpp +++ b/src/Base/Interpreter.cpp @@ -495,9 +495,15 @@ PyObject* InterpreterSingleton::addModule(Py::ExtensionModuleBase* mod) void InterpreterSingleton::cleanupModules() { - for (auto it : _modules) + // This is only needed to make the address sanitizer happy +#if defined(__has_feature) +# if __has_feature(address_sanitizer) + for (auto it : _modules) { delete it; + } _modules.clear(); +# endif +#endif } void InterpreterSingleton::addType(PyTypeObject* Type,PyObject* Module, const char * Name)