Skip to content
Merged
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
30 changes: 14 additions & 16 deletions src/sage/libs/gap/element.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -2498,32 +2498,30 @@ cdef class GapElement_Function(GapElement):
cdef Obj result = NULL
cdef Obj arg_list
cdef int n = len(args)
cdef volatile Obj v2

if n > 0 and n <= 3:
libgap = self.parent()
a = [x if isinstance(x, GapElement) else libgap(x) for x in args]
cdef Obj a[3]

if n <= 3:
if not all(isinstance(x, GapElement) for x in args):
libgap = self.parent()
args = tuple(x if isinstance(x, GapElement) else libgap(x) for x in args)
for i in range(n):
x = args[i]
a[i] = (<GapElement>x).value
else:
arg_list = make_gap_list(args)

try:
sig_GAP_Enter()
sig_on()
if n == 0:
result = GAP_CallFunc0Args(self.value)
elif n == 1:
result = GAP_CallFunc1Args(self.value,
(<GapElement>a[0]).value)
result = GAP_CallFunc1Args(self.value, a[0])
elif n == 2:
result = GAP_CallFunc2Args(self.value,
(<GapElement>a[0]).value,
(<GapElement>a[1]).value)
result = GAP_CallFunc2Args(self.value, a[0], a[1])
elif n == 3:
v2 = (<GapElement>a[2]).value
result = GAP_CallFunc3Args(self.value,
(<GapElement>a[0]).value,
(<GapElement>a[1]).value,
v2)
result = GAP_CallFunc3Args(self.value, a[0], a[1], a[2])
else:
arg_list = make_gap_list(args)
result = GAP_CallFuncList(self.value, arg_list)
sig_off()
finally:
Expand Down
Loading