From 03eddb5151a23799cb418021b91df31ca3565783 Mon Sep 17 00:00:00 2001 From: Benjamin Lorenz Date: Wed, 20 Dec 2023 14:19:16 +0100 Subject: [PATCH] gc preserve oscarnumber string --- src/oscarnumber.jl | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/oscarnumber.jl b/src/oscarnumber.jl index 51502627..ab599a02 100644 --- a/src/oscarnumber.jl +++ b/src/oscarnumber.jl @@ -249,7 +249,10 @@ end function _on_to_string(e::T) where T - return Cstring(pointer("$e")) + str = "$e" + return GC.@preserve str begin + Base.unsafe_convert(Cstring, str) + end end @generated _on_gen_to_string(::Type{ArgT}) where ArgT = quote