From cfe0869acee0793d5572feba22bfb1d5f215ce3c Mon Sep 17 00:00:00 2001 From: James Mitchell Date: Fri, 14 Aug 2026 12:05:39 +0100 Subject: [PATCH] schreier-sims: avoid allocating on stack in copy and __copy__ --- src/schreier-sims.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/schreier-sims.cpp b/src/schreier-sims.cpp index 994e0d05..4025be4b 100644 --- a/src/schreier-sims.cpp +++ b/src/schreier-sims.cpp @@ -78,11 +78,14 @@ the list *gens*. for this class, or the number of generators exceeds the maximum capacity. )pbdoc"); - thing.def("__copy__", - [](SchreierSims_ const& self) { return SchreierSims_(self); }); + thing.def("__copy__", [](SchreierSims_ const& self) { + return std::make_unique(self); + }); thing.def( "copy", - [](SchreierSims_ const& self) { return SchreierSims_(self); }, + [](SchreierSims_ const& self) { + return std::make_unique(self); + }, R"pbdoc( :sig=(self: SchreierSims) -> SchreierSims: