From 74640987c7d80961d804b8603ffcce6711aa55a6 Mon Sep 17 00:00:00 2001 From: Harmen Stoppels Date: Fri, 19 Apr 2024 14:33:42 +0200 Subject: [PATCH] ruamel yaml: fix quadratic complexity bug (#43745) --- .../external/_vendoring/ruamel/yaml/comments.py | 2 +- lib/spack/external/patches/ruamelyaml.patch | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 lib/spack/external/patches/ruamelyaml.patch diff --git a/lib/spack/external/_vendoring/ruamel/yaml/comments.py b/lib/spack/external/_vendoring/ruamel/yaml/comments.py index 892c868af3..1badeda585 100644 --- a/lib/spack/external/_vendoring/ruamel/yaml/comments.py +++ b/lib/spack/external/_vendoring/ruamel/yaml/comments.py @@ -497,7 +497,7 @@ def copy_attributes(self, t, memo=None): Tag.attrib, merge_attrib]: if hasattr(self, a): if memo is not None: - setattr(t, a, copy.deepcopy(getattr(self, a, memo))) + setattr(t, a, copy.deepcopy(getattr(self, a), memo)) else: setattr(t, a, getattr(self, a)) # fmt: on diff --git a/lib/spack/external/patches/ruamelyaml.patch b/lib/spack/external/patches/ruamelyaml.patch new file mode 100644 index 0000000000..24bf17f233 --- /dev/null +++ b/lib/spack/external/patches/ruamelyaml.patch @@ -0,0 +1,13 @@ +diff --git a/lib/spack/external/_vendoring/ruamel/yaml/comments.py b/lib/spack/external/_vendoring/ruamel/yaml/comments.py +index 1badeda585..892c868af3 100644 +--- a/lib/spack/external/_vendoring/ruamel/yaml/comments.py ++++ b/lib/spack/external/_vendoring/ruamel/yaml/comments.py +@@ -497,7 +497,7 @@ def copy_attributes(self, t, memo=None): + Tag.attrib, merge_attrib]: + if hasattr(self, a): + if memo is not None: +- setattr(t, a, copy.deepcopy(getattr(self, a, memo))) ++ setattr(t, a, copy.deepcopy(getattr(self, a), memo)) + else: + setattr(t, a, getattr(self, a)) + # fmt: on