Skip to content

Commit

Permalink
Avoid InstallValue for non-plain objects
Browse files Browse the repository at this point in the history
InstallValue is one of a tiny handful of places calling the GAP kernel
function CLONE_OBJ. This function is rather dangerous, e.g. for *types* it is
not really well-defined, see gap-system/gap#1637.
While I am not aware of any ill-effects of the usage here, I think it is best
to avoid it (and perhaps we can at some point even phase out support for
`InstallValue` used on non-plain objects)
  • Loading branch information
fingolfin committed Jun 30, 2022
1 parent 7150a69 commit 5d603c3
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 2 deletions.
1 change: 0 additions & 1 deletion lib/PrintUtil.gd
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@

## a filter for a bit tricky objects
DeclareFilter("IsObjToBePrinted");
DeclareGlobalVariable("DUMMYTBPTYPE");

DeclareGlobalFunction("PrintTo1");
DeclareGlobalFunction("AppendTo1");
Expand Down
2 changes: 1 addition & 1 deletion lib/PrintUtil.gi
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
##

## a hack: type for objects which only exist to print something
InstallValue(DUMMYTBPTYPE, NewType(NewFamily(""), IsObjToBePrinted));
BindGlobal("DUMMYTBPTYPE", NewType(NewFamily(""), IsObjToBePrinted));


InstallMethod(PrintObj, "IsObjToBePrinted", true, [IsObjToBePrinted], 0,
Expand Down

0 comments on commit 5d603c3

Please sign in to comment.