Skip to content

Commit 28a27ab

Browse files
committed
in general, do not use a known Name value in PrintObj
Use a known `Name` value in `PrintObj` only if a global variable with this name exists.
1 parent 3963ca0 commit 28a27ab

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

lib/object.gi

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,13 @@ InstallMethod( PrintObj,
384384
true,
385385
[ HasName ],
386386
SUM_FLAGS, # override anything specific
387-
function ( obj ) Print( Name( obj ) ); end );
387+
function( obj )
388+
if ISBOUND_GLOBAL( Name( obj ) ) then
389+
Print( Name( obj ) );
390+
else
391+
TryNextMethod();
392+
fi;
393+
end );
388394

389395

390396
#############################################################################

tst/teststandard/simplegrpit.tst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ PSL(2,59)
4141

4242
#
4343
gap> it := SimpleGroupsIterator(20000,80000:NOPSL2);;
44-
gap> for g in it do Print(g,"\n"); od;
44+
gap> for g in it do View( g ); Print( "\n" ); od;
4545
A8
4646
PSL(3,4)
4747
PSp(4,3)
@@ -50,7 +50,7 @@ PSU(3,4)
5050
gap> IsDoneIterator(it);
5151
true
5252
gap> it:=SimpleGroupsIterator(1053927211015007279,1053927211015007281);;
53-
gap> for g in it do Print(g,"\n"); od;
53+
gap> for g in it do View( g ); Print( "\n" ); od;
5454
PSL(3,179)
5555

5656
#

0 commit comments

Comments
 (0)