Skip to content
Draft
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
26 changes: 15 additions & 11 deletions src/sage/libs/gap/element.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -45,21 +45,25 @@
- ``a`` -- list of :class:`GapElement`

OUTPUT: list of the elements in ``a`` as a Gap ``Obj``

TESTS::

sage: from sage.doctest.util import ensure_interruptible_after
sage: for i in range(10):

Check failure on line 52 in src/sage/libs/gap/element.pyx

View workflow job for this annotation

GitHub Actions / test-long (src/sage/[g-o]*)

Failed example:

Failed example:: Exception raised: Traceback (most recent call last): File "/sage/src/sage/doctest/forker.py", line 733, in _run self.compile_and_execute(example, compiler, test.globs) File "/sage/src/sage/doctest/forker.py", line 1157, in compile_and_execute exec(compiled, globs) File "<doctest sage.libs.gap.element.NULL[1]>", line 2, in <module> with ensure_interruptible_after(RealNumber('0.1')): File "/usr/lib/python3.12/contextlib.py", line 144, in __exit__ next(self.gen) File "/sage/src/sage/doctest/util.py", line 912, in ensure_interruptible_after raise RuntimeError(f"Function terminates early after {elapsed:.4f} < {seconds:.4f} seconds") RuntimeError: Function terminates early after 0.0681 < 0.1000 seconds

Check failure on line 52 in src/sage/libs/gap/element.pyx

View workflow job for this annotation

GitHub Actions / Conda (ubuntu, Python 3.12, new)

Failed example:

Failed example:: Exception raised: Traceback (most recent call last): File "/usr/share/miniconda/envs/sage-dev/lib/python3.12/site-packages/sage/doctest/forker.py", line 733, in _run self.compile_and_execute(example, compiler, test.globs) File "/usr/share/miniconda/envs/sage-dev/lib/python3.12/site-packages/sage/doctest/forker.py", line 1157, in compile_and_execute exec(compiled, globs) File "<doctest sage.libs.gap.element.NULL[1]>", line 2, in <module> with ensure_interruptible_after(RealNumber('0.1')): ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/share/miniconda/envs/sage-dev/lib/python3.12/contextlib.py", line 144, in __exit__ next(self.gen) File "/usr/share/miniconda/envs/sage-dev/lib/python3.12/site-packages/sage/doctest/util.py", line 912, in ensure_interruptible_after raise RuntimeError(f"Function terminates early after {elapsed:.4f} < {seconds:.4f} seconds") RuntimeError: Function terminates early after 0.0633 < 0.1000 seconds

Check failure on line 52 in src/sage/libs/gap/element.pyx

View workflow job for this annotation

GitHub Actions / Conda (ubuntu, Python 3.12, all)

Failed example:

Failed example:: Exception raised: Traceback (most recent call last): File "/usr/share/miniconda/envs/sage-dev/lib/python3.12/site-packages/sage/doctest/forker.py", line 733, in _run self.compile_and_execute(example, compiler, test.globs) File "/usr/share/miniconda/envs/sage-dev/lib/python3.12/site-packages/sage/doctest/forker.py", line 1157, in compile_and_execute exec(compiled, globs) File "<doctest sage.libs.gap.element.NULL[1]>", line 2, in <module> with ensure_interruptible_after(RealNumber('0.1')): ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/share/miniconda/envs/sage-dev/lib/python3.12/contextlib.py", line 144, in __exit__ next(self.gen) File "/usr/share/miniconda/envs/sage-dev/lib/python3.12/site-packages/sage/doctest/util.py", line 912, in ensure_interruptible_after raise RuntimeError(f"Function terminates early after {elapsed:.4f} < {seconds:.4f} seconds") RuntimeError: Function terminates early after 0.1191 < 0.1000 seconds

Check failure on line 52 in src/sage/libs/gap/element.pyx

View workflow job for this annotation

GitHub Actions / Conda (ubuntu, Python 3.11, all)

Failed example:

Failed example:: Exception raised: Traceback (most recent call last): File "/usr/share/miniconda/envs/sage-dev/lib/python3.11/site-packages/sage/doctest/forker.py", line 733, in _run self.compile_and_execute(example, compiler, test.globs) File "/usr/share/miniconda/envs/sage-dev/lib/python3.11/site-packages/sage/doctest/forker.py", line 1157, in compile_and_execute exec(compiled, globs) File "<doctest sage.libs.gap.element.NULL[1]>", line 2, in <module> with ensure_interruptible_after(RealNumber('0.1')): File "/usr/share/miniconda/envs/sage-dev/lib/python3.11/contextlib.py", line 144, in __exit__ next(self.gen) File "/usr/share/miniconda/envs/sage-dev/lib/python3.11/site-packages/sage/doctest/util.py", line 912, in ensure_interruptible_after raise RuntimeError(f"Function terminates early after {elapsed:.4f} < {seconds:.4f} seconds") RuntimeError: Function terminates early after 0.1346 < 0.1000 seconds

Check failure on line 52 in src/sage/libs/gap/element.pyx

View workflow job for this annotation

GitHub Actions / Conda (ubuntu, Python 3.12, all, editable)

Failed example:

Failed example:: Exception raised: Traceback (most recent call last): File "/home/runner/work/sage/sage/src/sage/doctest/forker.py", line 733, in _run self.compile_and_execute(example, compiler, test.globs) File "/home/runner/work/sage/sage/src/sage/doctest/forker.py", line 1157, in compile_and_execute exec(compiled, globs) File "<doctest sage.libs.gap.element.NULL[1]>", line 2, in <module> with ensure_interruptible_after(RealNumber('0.1')): ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/share/miniconda/envs/sage-dev/lib/python3.12/contextlib.py", line 144, in __exit__ next(self.gen) File "/home/runner/work/sage/sage/src/sage/doctest/util.py", line 912, in ensure_interruptible_after raise RuntimeError(f"Function terminates early after {elapsed:.4f} < {seconds:.4f} seconds") RuntimeError: Function terminates early after 0.0980 < 0.1000 seconds

Check failure on line 52 in src/sage/libs/gap/element.pyx

View workflow job for this annotation

GitHub Actions / Conda (macos, Python 3.11, all)

Failed example:

Failed example:: Exception raised: Traceback (most recent call last): File "/Users/runner/miniconda3/envs/sage-dev/lib/python3.11/site-packages/sage/doctest/forker.py", line 733, in _run self.compile_and_execute(example, compiler, test.globs) File "/Users/runner/miniconda3/envs/sage-dev/lib/python3.11/site-packages/sage/doctest/forker.py", line 1157, in compile_and_execute exec(compiled, globs) File "<doctest sage.libs.gap.element.NULL[1]>", line 2, in <module> with ensure_interruptible_after(RealNumber('0.1')): File "/Users/runner/miniconda3/envs/sage-dev/lib/python3.11/contextlib.py", line 144, in __exit__ next(self.gen) File "/Users/runner/miniconda3/envs/sage-dev/lib/python3.11/site-packages/sage/doctest/util.py", line 912, in ensure_interruptible_after raise RuntimeError(f"Function terminates early after {elapsed:.4f} < {seconds:.4f} seconds") RuntimeError: Function terminates early after 0.0657 < 0.1000 seconds

Check failure on line 52 in src/sage/libs/gap/element.pyx

View workflow job for this annotation

GitHub Actions / Conda (macos, Python 3.12, all)

Failed example:

Failed example:: Exception raised: Traceback (most recent call last): File "/Users/runner/miniconda3/envs/sage-dev/lib/python3.12/site-packages/sage/doctest/forker.py", line 733, in _run self.compile_and_execute(example, compiler, test.globs) File "/Users/runner/miniconda3/envs/sage-dev/lib/python3.12/site-packages/sage/doctest/forker.py", line 1157, in compile_and_execute exec(compiled, globs) File "<doctest sage.libs.gap.element.NULL[1]>", line 2, in <module> with ensure_interruptible_after(RealNumber('0.1')): ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/runner/miniconda3/envs/sage-dev/lib/python3.12/contextlib.py", line 144, in __exit__ next(self.gen) File "/Users/runner/miniconda3/envs/sage-dev/lib/python3.12/site-packages/sage/doctest/util.py", line 912, in ensure_interruptible_after raise RuntimeError(f"Function terminates early after {elapsed:.4f} < {seconds:.4f} seconds") RuntimeError: Function terminates early after 0.0887 < 0.1000 seconds
....: with ensure_interruptible_after(0.1):
....: ignore = libgap([1000]*10000)
....: with ensure_interruptible_after(0.3):
....: ignore = libgap([1000]*100000)
"""
cdef Obj l
cdef GapElement elem
cdef int i
cdef tuple gap_elements = tuple(x if isinstance(x, GapElement) else libgap(x) for x in sage_list)
cdef Py_ssize_t n = len(gap_elements), i

try:
GAP_Enter()
l = GAP_NewPlist(0)

for i, x in enumerate(sage_list):
if not isinstance(x, GapElement):
elem = <GapElement>libgap(x)
else:
elem = <GapElement>x

GAP_AssList(l, i + 1, elem.value)
l = GAP_NewPlist(n)
for i in range(n):
GAP_AssList(l, i + 1, (<GapElement> gap_elements[i]).value)
return l
finally:
GAP_Leave()
Expand Down
Loading