Skip to content

Commit bcf4710

Browse files
author
Release Manager
committed
gh-39906: Fix error in exception handling code of gap interface Previously the (newly-added) test would raise ``` TypeError: argument of type 'RuntimeError' is not iterable ``` instead, because `RuntimeError(exc)` will create an object that is `RuntimeError(RuntimeError('Gap produced error output...'))` instead, and later there is a check that is `if "Input/output error" in msg.args[0]:` which would fail if `msg.args[0]` is not a string. ### 📝 Checklist <!-- Put an `x` in all the boxes that apply. --> - [x] The title is concise and informative. - [x] The description explains in detail what this PR is about. - [ ] I have linked a relevant issue or discussion. - [x] I have created tests covering the changes. - [x] I have updated the documentation and checked the documentation preview. ### ⌛ Dependencies <!-- List all open PRs that this PR logically depends on. For example, --> <!-- - #12345: short description why this is a dependency --> <!-- - #34567: ... --> URL: #39906 Reported by: user202729 Reviewer(s): Travis Scrimshaw
2 parents 7f39904 + 01782d6 commit bcf4710

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/sage/interfaces/gap.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -670,6 +670,15 @@ def _eval_line(self, line, allow_use_file=True, wait_for_prompt=True, restart_if
670670
Restarting Gap and trying again
671671
sage: a
672672
3
673+
674+
Checks for :issue:`39906`::
675+
676+
sage: gap("a"*200)
677+
Traceback (most recent call last):
678+
...
679+
TypeError: Gap terminated unexpectedly while reading in a large line:
680+
Gap produced error output
681+
Error, Variable: 'aaaa...aaaa' must have a value executing Read("...");
673682
"""
674683
expect_eof = self._quit_string() in line
675684

@@ -728,7 +737,7 @@ def _eval_line(self, line, allow_use_file=True, wait_for_prompt=True, restart_if
728737
else:
729738
return ''
730739
else:
731-
raise RuntimeError(exc)
740+
raise exc
732741

733742
except KeyboardInterrupt:
734743
self._keyboard_interrupt()

0 commit comments

Comments
 (0)