Skip to content

Commit

Permalink
Merge pull request #36548 from mantidproject/0_add_ads_clear_warning
Browse files Browse the repository at this point in the history
Added warning for ADS.clear()
  • Loading branch information
RichardWaiteSTFC authored Dec 19, 2023
2 parents 12c8048 + b673a36 commit 4e14bf7
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,8 @@ template <typename SvcType, typename SvcPtrType> struct DataServiceExporter {
* @param self A reference to the calling object
*/
static void clearItems(SvcType &self) {
PyErr_Warn(PyExc_Warning, "Running ADS.clear() also removes all hidden workspaces.\n"
"Mantid interfaces might still need some of these, for instance, MSlice.");
ReleaseGlobalInterpreterLock releaseGIL;
self.clear();
}
Expand Down
2 changes: 1 addition & 1 deletion buildconfig/CMake/CppCheck_Suppressions.txt.in
Original file line number Diff line number Diff line change
Expand Up @@ -951,7 +951,7 @@ unknownMacro:${CMAKE_SOURCE_DIR}/Framework/PythonInterface/mantid/kernel/src/Exp
constParameterPointer:${CMAKE_SOURCE_DIR}/Framework/PythonInterface/core/inc/MantidPythonInterface/core/IsNone.h:26
constVariablePointer:${CMAKE_SOURCE_DIR}/Framework/Muon/src/PlotAsymmetryByLogValue.cpp:216
unknownMacro:${CMAKE_SOURCE_DIR}/Framework/PythonInterface/mantid/kernel/src/Exports/Statistics.cpp:109
constParameterCallback:${CMAKE_SOURCE_DIR}/Framework/PythonInterface/core/inc/MantidPythonInterface/core/DataServiceExporter.h:153
constParameterCallback:${CMAKE_SOURCE_DIR}/Framework/PythonInterface/core/inc/MantidPythonInterface/core/DataServiceExporter.h:155
unknownMacro:${CMAKE_SOURCE_DIR}/Framework/PythonInterface/mantid/geometry/src/Exports/Component.cpp:23
useStlAlgorithm:${CMAKE_SOURCE_DIR}/Framework/PythonInterface/mantid/geometry/src/Exports/DetectorGroup.cpp:34
unknownMacro:${CMAKE_SOURCE_DIR}/Framework/PythonInterface/mantid/geometry/src/Exports/Goniometer.cpp:30
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- The ``clear()`` function for the ADS now displays a warning that workspaces might get removed that are still used by one of the interfaces.

0 comments on commit 4e14bf7

Please sign in to comment.