Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

in general, do not use a known Name value in PrintObj #5701

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion lib/object.gi
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,13 @@
true,
[ HasName ],
SUM_FLAGS, # override anything specific
function ( obj ) Print( Name( obj ) ); end );
function( obj )
if ISBOUND_GLOBAL( Name( obj ) ) then
Print( Name( obj ) );
Comment on lines +388 to +389
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should only be triggered if the variable with that name actually contains the object. I.e. like so:

Suggested change
if ISBOUND_GLOBAL( Name( obj ) ) then
Print( Name( obj ) );
local name;
name := Name( obj );
if ISBOUND_GLOBAL( name ) and IS_IDENTICAL_OBJ( VALUE_GLOBAL( name ), obj ) then
Print( name );

else
TryNextMethod();

Check warning on line 391 in lib/object.gi

View check run for this annotation

Codecov / codecov/patch

lib/object.gi#L391

Added line #L391 was not covered by tests
fi;
end );


#############################################################################
Expand Down
4 changes: 2 additions & 2 deletions tst/teststandard/simplegrpit.tst
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ PSL(2,59)

#
gap> it := SimpleGroupsIterator(20000,80000:NOPSL2);;
gap> for g in it do Print(g,"\n"); od;
gap> for g in it do View( g ); Print( "\n" ); od;
A8
PSL(3,4)
PSp(4,3)
Expand All @@ -50,7 +50,7 @@ PSU(3,4)
gap> IsDoneIterator(it);
true
gap> it:=SimpleGroupsIterator(1053927211015007279,1053927211015007281);;
gap> for g in it do Print(g,"\n"); od;
gap> for g in it do View( g ); Print( "\n" ); od;
PSL(3,179)

#
Expand Down
Loading