From 4c0e0f126cd6093b622eaad32db50ff9192b7501 Mon Sep 17 00:00:00 2001 From: Max Horn <max@quendi.de> Date: Sun, 5 Nov 2023 02:37:38 +0100 Subject: [PATCH] Improve with_unicode Some time ago `with_unicode` was improved in Oscar, apply that here. --- src/AbstractAlgebra.jl | 2 +- src/PrettyPrinting.jl | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/AbstractAlgebra.jl b/src/AbstractAlgebra.jl index 0923169fe9..badbd1da9f 100644 --- a/src/AbstractAlgebra.jl +++ b/src/AbstractAlgebra.jl @@ -18,7 +18,7 @@ import GroupsCore import GroupsCore: gens, ngens, order, mul!, istrivial # A list of all symbols external packages should not import from AbstractAlgebra -import_exclude = [:import_exclude, :QQ, :ZZ, +const import_exclude = [:import_exclude, :QQ, :ZZ, :RealField, :number_field, :AbstractAlgebra, :inv, :log, :exp, :sqrt, :div, :divrem, diff --git a/src/PrettyPrinting.jl b/src/PrettyPrinting.jl index 7ff2aca88e..6c5654b28d 100644 --- a/src/PrettyPrinting.jl +++ b/src/PrettyPrinting.jl @@ -1398,9 +1398,12 @@ function is_unicode_allowed() end function with_unicode(f::Function) - old_allow_unicode = allow_unicode(true); - f() - allow_unicode(old_allow_unicode); + old_allow_unicode = allow_unicode(true) + try + f() + finally + allow_unicode(old_allow_unicode) + end end ################################################################################