Skip to content

GAP interface broken after CTRL-C #3294

@wdjoyner

Description

@wdjoyner

For example (you need to hit CTRL-C pretty quickly to beat the first line...):

sage: gap.eval('B := ExtendedBinaryGolayCode();')
^CInterrupting Gap...
---------------------------------------------------------------------------
KeyboardInterrupt                         Traceback (most recent call last)

/Users/rlmill/sage-3.0.6/<ipython console> in <module>()

/Users/rlmill/sage-3.0.6/local/lib/python2.5/site-packages/sage/interfaces/gap.py in eval(self, x, newlines, strip)
    307         if len(x) == 0 or x[len(x) - 1] != ';':
    308             x += ';'
--> 309         s = Expect.eval(self, x)
    310         if newlines:
    311             return s

/Users/rlmill/sage-3.0.6/local/lib/python2.5/site-packages/sage/interfaces/expect.py in eval(self, code, strip, synchronize, **kwds)
    915         try:
    916             with gc_disabled():
--> 917                 return '\n'.join([self._eval_line(L, **kwds) for L in code.split('\n') if L != ''])
    918         except KeyboardInterrupt:
    919             # DO NOT CATCH KeyboardInterrupt, as it is being caught

/Users/rlmill/sage-3.0.6/local/lib/python2.5/site-packages/sage/interfaces/gap.py in _eval_line(self, line, allow_use_file, wait_for_prompt)
    511 
    512         except KeyboardInterrupt:
--> 513             self._keyboard_interrupt()
    514             raise KeyboardInterrupt, "Ctrl-c pressed while running %s"%self
    515 #        i = out.find("\n")

/Users/rlmill/sage-3.0.6/local/lib/python2.5/site-packages/sage/interfaces/gap.py in _keyboard_interrupt(self)
    448         print "Interrupting %s..."%self
    449         os.killpg(self._expect.pid, 2)
--> 450         raise KeyboardInterrupt, "Ctrl-c pressed while running %s"%self
    451 
    452     def _eval_line_using_file(self, line):

KeyboardInterrupt: Ctrl-c pressed while running Gap

Now we try to do something else using GAP:

sage: C = ReedSolomonCode(4,3,GF(5)); C
Linear code of length 4, dimension 3 over Finite Field of size 5
sage: C.minimum_distance()
---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)

/Users/rlmill/sage-3.0.6/<ipython console> in <module>()

/Users/rlmill/sage-3.0.6/local/lib/python2.5/site-packages/sage/coding/linear_code.py in minimum_distance(self)
   1366         q = F.order()
   1367         G = self.gen_mat()
-> 1368         gapG = gap(G)
   1369         Gstr = "%s*Z(%s)^0"%(gapG, q)
   1370         return hamming_weight(min_wt_vec(Gstr,F))

/Users/rlmill/sage-3.0.6/local/lib/python2.5/site-packages/sage/interfaces/expect.py in __call__(self, x, name)
    945             return cls(self, x, name=name)
    946         try:
--> 947             return self._coerce_from_special_method(x)
    948         except TypeError:
    949             raise

/Users/rlmill/sage-3.0.6/local/lib/python2.5/site-packages/sage/interfaces/expect.py in _coerce_from_special_method(self, x)
    969             s = '_gp_'
    970         try:
--> 971             return (x.__getattribute__(s))(self)
    972         except AttributeError:
    973             return self(x._interface_init_())

/Users/rlmill/sage-3.0.6/sage_object.pyx in sage.structure.sage_object.SageObject._gap_ (sage/structure/sage_object.c:2456)()

/Users/rlmill/sage-3.0.6/sage_object.pyx in sage.structure.sage_object.SageObject._interface_ (sage/structure/sage_object.c:2082)()

/Users/rlmill/sage-3.0.6/matrix1.pyx in sage.matrix.matrix1.Matrix._gap_init_ (sage/matrix/matrix1.c:1447)()

/Users/rlmill/sage-3.0.6/integer_mod.pyx in sage.rings.integer_mod.IntegerMod_abstract._gap_init_ (sage/rings/integer_mod.c:3315)()

/Users/rlmill/sage-3.0.6/local/lib/python2.5/site-packages/sage/interfaces/gap.py in eval(self, x, newlines, strip)
    307         if len(x) == 0 or x[len(x) - 1] != ';':
    308             x += ';'
--> 309         s = Expect.eval(self, x)
    310         if newlines:
    311             return s

/Users/rlmill/sage-3.0.6/local/lib/python2.5/site-packages/sage/interfaces/expect.py in eval(self, code, strip, synchronize, **kwds)
    915         try:
    916             with gc_disabled():
--> 917                 return '\n'.join([self._eval_line(L, **kwds) for L in code.split('\n') if L != ''])
    918         except KeyboardInterrupt:
    919             # DO NOT CATCH KeyboardInterrupt, as it is being caught

/Users/rlmill/sage-3.0.6/local/lib/python2.5/site-packages/sage/interfaces/gap.py in _eval_line(self, line, allow_use_file, wait_for_prompt)
    508                         return ''
    509                 else:
--> 510                     raise RuntimeError, message
    511 
    512         except KeyboardInterrupt:

RuntimeError: Gap produced error output
user interrupt while printing

   executing Int(Z(5));

Component: interfaces

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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions