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

GAP3 does not have IsIdenticalObject #19795

Closed
vbraun opened this issue Dec 28, 2015 · 16 comments
Closed

GAP3 does not have IsIdenticalObject #19795

vbraun opened this issue Dec 28, 2015 · 16 comments

Comments

@vbraun
Copy link
Member

vbraun commented Dec 28, 2015

Looks like a regression introduced in #19585. Reported at https://groups.google.com/d/msg/sage-devel/MrXp43v3WP4/ju2LwTuvBAAJ

sage: gap=Gap3('/Applications/gap3r4p4/bin/gap')
sage: gap.RequirePackage('"specht"')
---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
<ipython-input-22-c539883f0214> in <module>()
----> 1 gap.RequirePackage('"specht"')

/Applications/sage/local/lib/python2.7/site-packages/sage/interfaces/interface.pyc in __call__(self, *args, **kwds)
    605 
    606     def __call__(self, *args, **kwds):
--> 607         return self._parent.function_call(self._name, list(args), kwds)
    608 
    609     def _sage_doc_(self):

/Applications/sage/local/lib/python2.7/site-packages/sage/interfaces/gap.pyc in function_call(self, function, args, kwds)
    919             self.eval(marker)
    920             res = self.eval(cmd)
--> 921         if self.eval('IsIdenticalObj(last,__SAGE_LAST__)') != 'true':
    922             return self.new('last2;')
    923         else:

/Applications/sage/local/lib/python2.7/site-packages/sage/interfaces/gap.pyc in eval(self, x, newlines, strip, split_lines, **kwds)
    567             if not input_line.endswith(';'):
    568                 input_line += ';'
--> 569         result = Expect.eval(self, input_line, **kwds)
    570         if not newlines:
    571             result = result.replace("\\\n","")

/Applications/sage/local/lib/python2.7/site-packages/sage/interfaces/expect.pyc in eval(self, code, strip, synchronize, locals, allow_use_file, split_lines, **kwds)
   1237                 elif split_lines:
   1238                     return '\n'.join([self._eval_line(L, allow_use_file=allow_use_file, **kwds)
-> 1239                                         for L in code.split('\n') if L != ''])
   1240                 else:
   1241                     return self._eval_line(code, allow_use_file=allow_use_file, **kwds)

/Applications/sage/local/lib/python2.7/site-packages/sage/interfaces/gap.pyc in _eval_line(self, line, allow_use_file, wait_for_prompt, restart_if_needed)
    765                     return ''
    766             else:
--> 767                 raise RuntimeError(message)
    768 
    769         except KeyboardInterrupt:

RuntimeError: Gap3 produced error output
Error, Variable: 'IsIdenticalObj' must have a value

   executing IsIdenticalObj(last,__SAGE_LAST__);

CC: @jaanos @tscrim @anneschilling

Component: packages: standard

Keywords: gap

Author: Travis Scrimshaw, Janoš Vidali

Branch/Commit: efdffd5

Reviewer: Anne Schilling

Issue created by migration from https://trac.sagemath.org/ticket/19795

@vbraun vbraun added this to the sage-7.0 milestone Dec 28, 2015
@tscrim
Copy link
Collaborator

tscrim commented Dec 29, 2015

comment:2

So GAP3 has IsIdentical, which was changed to IsIdenticalObj in GAP4b3. I think what we need to do is either:

  • a subclass of the GAP interpreter for backwards compatibility with GAP3 which just has the one difference in function_call(),
  • check the GAP version in the __init__ and set some private attribute which gets used in function_call(), or
  • store the GAP version as an attribute and use an if statement in function_call().

@anneschilling For now you should be able to make that one line change mentioned above to sage.interfaces.gap.function_call (but I haven't tested it).

@jaanos
Copy link

jaanos commented Dec 29, 2015

comment:3

Hi!

  • a subclass of the GAP interpreter for backwards compatibility with GAP3 which just has the one difference in function_call(),

There already is a separate class for GAP3 which inherits from Gap_generic. The cleanest solution IMO would be to have a method _identical_function in Gap_generic (parallel to _equality_symbol etc.), say:

def _identical_function(self):
    return "IsIdenticalObj"

and then have it overridden in Gap3.

@tscrim
Copy link
Collaborator

tscrim commented Dec 29, 2015

Commit: 8ff1fe8

@tscrim
Copy link
Collaborator

tscrim commented Dec 29, 2015

Branch: public/interfaces/fix_gap3-19795

@tscrim
Copy link
Collaborator

tscrim commented Dec 29, 2015

Author: Travis Scrimshaw, Janoš Vidali

@tscrim
Copy link
Collaborator

tscrim commented Dec 29, 2015

comment:4

Replying to @jaanos:

  • a subclass of the GAP interpreter for backwards compatibility with GAP3 which just has the one difference in function_call(),

There already is a separate class for GAP3 which inherits from Gap_generic.

Good; let us use that.

The cleanest solution IMO would be to have a method _identical_function in Gap_generic (parallel to _equality_symbol etc.), say:

def _identical_function(self):
    return "IsIdenticalObj"

and then have it overridden in Gap3.

I think it should be a class-level attribute instead of a method because it speed cost and a method is IMO somewhat overkill (because no work is done).

Anne, can you check to see if this works?


New commits:

8ff1fe8Adding an identical function class attribute.

@anneschilling
Copy link

comment:5

Replying to @tscrim:

Replying to @jaanos:

  • a subclass of the GAP interpreter for backwards compatibility with GAP3 which just has the one difference in function_call(),

There already is a separate class for GAP3 which inherits from Gap_generic.

Good; let us use that.

The cleanest solution IMO would be to have a method _identical_function in Gap_generic (parallel to _equality_symbol etc.), say:

def _identical_function(self):
    return "IsIdenticalObj"

and then have it overridden in Gap3.

I think it should be a class-level attribute instead of a method because it speed cost and a method is IMO somewhat overkill (because no work is done).

Anne, can you check to see if this works?


New commits:

8ff1fe8Adding an identical function class attribute.

With this branch applied, I still get an error

sage: gap=Gap3('/Applications/gap3r4p4/bin/gap')
sage: gap.RequirePackage('"specht"')
---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
<ipython-input-2-c539883f0214> in <module>()
----> 1 gap.RequirePackage('"specht"')

/Applications/sage/local/lib/python2.7/site-packages/sage/interfaces/interface.pyc in __call__(self, *args, **kwds)
    605 
    606     def __call__(self, *args, **kwds):
--> 607         return self._parent.function_call(self._name, list(args), kwds)
    608 
    609     def _sage_doc_(self):

/Applications/sage/local/lib/python2.7/site-packages/sage/interfaces/gap.pyc in function_call(self, function, args, kwds)
    920             self.eval(marker)
    921             res = self.eval(cmd)
--> 922         if self.eval(self._identical_function + '(last,__SAGE_LAST__)') != 'true':
    923             return self.new('last2;')
    924         else:

/Applications/sage/local/lib/python2.7/site-packages/sage/interfaces/gap.pyc in eval(self, x, newlines, strip, split_lines, **kwds)
    568             if not input_line.endswith(';'):
    569                 input_line += ';'
--> 570         result = Expect.eval(self, input_line, **kwds)
    571         if not newlines:
    572             result = result.replace("\\\n","")

/Applications/sage/local/lib/python2.7/site-packages/sage/interfaces/expect.pyc in eval(self, code, strip, synchronize, locals, allow_use_file, split_lines, **kwds)
   1237                 elif split_lines:
   1238                     return '\n'.join([self._eval_line(L, allow_use_file=allow_use_file, **kwds)
-> 1239                                         for L in code.split('\n') if L != ''])
   1240                 else:
   1241                     return self._eval_line(code, allow_use_file=allow_use_file, **kwds)

/Applications/sage/local/lib/python2.7/site-packages/sage/interfaces/gap.pyc in _eval_line(self, line, allow_use_file, wait_for_prompt, restart_if_needed)
    766                     return ''
    767             else:
--> 768                 raise RuntimeError(message)
    769 
    770         except KeyboardInterrupt:

RuntimeError: Gap3 produced error output
Error, Variable: 'IsIdenticalObj' must have a value

   executing IsIdenticalObj(last,__SAGE_LAST__);

I will be traveling for at least 15 hours now and won't have any internet on the plane ....

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Dec 30, 2015

Branch pushed to git repo; I updated commit sha1. New commits:

efdffd5Putting the class attribute in the correct place.

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Dec 30, 2015

Changed commit from 8ff1fe8 to efdffd5

@tscrim
Copy link
Collaborator

tscrim commented Dec 30, 2015

comment:7

Whoops. I put it in the wrong place. Try it now.

Have a great flight!

@anneschilling
Copy link

comment:8

Replying to @tscrim:

Whoops. I put it in the wrong place. Try it now.

Yes, now it works!

sage: gap=Gap3('/Applications/gap3r4p4/bin/gap')
sage: gap.RequirePackage('"specht"')
------------------------------------------------------
SPECHT 3.1 - development edition                      
    A package for calculating decomposition numbers of
    Hecke algebras of the symmetric groups and q-Schur
    algebras.

    This is an unofficial release of SPECHT. There are
    a significant number of  *undocumented*  functions
    in this version. Fewer old bugs, and more new bugs
    are also included.

(C) Andrew Mathas  mathas@maths.usyd.edu.au     Sydney
------------------------------------------------------

@tscrim
Copy link
Collaborator

tscrim commented Jan 1, 2016

comment:9

Can we consider that a positive review then?

@anneschilling
Copy link

Reviewer: Anne Schilling

@anneschilling
Copy link

Changed keywords from none to gap

@anneschilling
Copy link

comment:12

Replying to @tscrim:

Can we consider that a positive review then?

Thank you for fixing this! Happy New Year!

@vbraun
Copy link
Member Author

vbraun commented Jan 2, 2016

Changed branch from public/interfaces/fix_gap3-19795 to efdffd5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants