From 31ee918371f1f68d5de7ffabe839562a2f44d4ee Mon Sep 17 00:00:00 2001 From: Max Horn Date: Fri, 2 May 2025 00:15:21 +0200 Subject: [PATCH] Remove bad generic sqrt method Method dispatch does not take keyword arguments into account. Therefore the kind of dispatch used by this method is risky and can result in an infinite recursion. --- src/Rings.jl | 9 --------- 1 file changed, 9 deletions(-) diff --git a/src/Rings.jl b/src/Rings.jl index e584b524fb..ace1c4f950 100644 --- a/src/Rings.jl +++ b/src/Rings.jl @@ -179,15 +179,6 @@ function Base.sqrt(a::FieldElem; check::Bool=true) error("Element $a does not have a square root") end -# assumes the existence of sqrt without check argument for input -function Base.sqrt(a::RingElem; check::Bool=true) - s = sqrt(a) - if check - s != a^2 && error("Element $a does not have a square root") - end - return s -end - # assumes the existence of is_square and sqrt for input function is_square_with_sqrt(a::RingElem) if is_square(a)