File tree Expand file tree Collapse file tree 1 file changed +14
-10
lines changed Expand file tree Collapse file tree 1 file changed +14
-10
lines changed Original file line number Diff line number Diff line change @@ -45,21 +45,25 @@ cdef Obj make_gap_list(sage_list) except NULL:
4545 - ``a`` -- list of :class:`GapElement`
4646
4747 OUTPUT: list of the elements in ``a`` as a Gap ``Obj``
48+
49+ TESTS::
50+
51+ sage: from sage.doctest.util import ensure_interruptible_after
52+ sage: for i in range(10):
53+ ....: with ensure_interruptible_after(0.1):
54+ ....: ignore = libgap([1000]*10000)
55+ ....: with ensure_interruptible_after(0.3):
56+ ....: ignore = libgap([1000]*100000)
4857 """
4958 cdef Obj l
50- cdef GapElement elem
51- cdef int i
59+ cdef tuple gap_elements = tuple (x if isinstance (x, GapElement) else libgap(x) for x in sage_list)
60+ cdef Py_ssize_t n = len (gap_elements), i
61+
5262 try :
5363 GAP_Enter()
5464 l = GAP_NewPlist(0 )
55-
56- for i, x in enumerate (sage_list):
57- if not isinstance (x, GapElement):
58- elem = < GapElement> libgap(x)
59- else :
60- elem = < GapElement> x
61-
62- GAP_AssList(l, i + 1 , elem.value)
65+ for i in range (n):
66+ GAP_AssList(l, i + 1 , (< GapElement> gap_elements[i]).value)
6367 return l
6468 finally :
6569 GAP_Leave()
You can’t perform that action at this time.
0 commit comments