bpo-42426: IDLE: Fix reporting offset of the RE error in searchengine#23447
Conversation
9360904 to
8a96705
Compare
terryjreedy
left a comment
There was a problem hiding this comment.
The first two comments, on the buggy old code, are for me and any other future readers.
I will merge when the retest passes.
| except re.error as what: | ||
| args = what.args | ||
| msg = args[0] | ||
| col = args[1] if len(args) >= 2 else -1 |
There was a problem hiding this comment.
This was my 'fix' for the original 2020 code that had msg, col = what. Even is args was a 3-tuple as I expected (see issue), that should have been args[2]. Since args is a 1-tuple, this always resulted in -1.
| engine.revar.set(1) | ||
| Equal(engine.getprog(), None) | ||
| self.assertEqual(Mbox.showerror.message, | ||
| 'Error: nothing to repeat at position 0\nPattern: +') |
There was a problem hiding this comment.
When I reviewed this file, written by GSOC student, I missed that this test passes because the buggy expected matches the buggy result of buggy code.
| msg = args[0] | ||
| col = args[1] if len(args) >= 2 else -1 | ||
| self.report_error(pat, msg, col) | ||
| except re.error as e: |
There was a problem hiding this comment.
I like the change to 'e' and simplification of code.
|
Thanks @serhiy-storchaka for the PR, and @terryjreedy for merging it 🌮🎉.. I'm working now to backport this PR to: 3.8, 3.9. |
…pythonGH-23447) (cherry picked from commit 453bc1d) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
|
GH-23453 is a backport of this pull request to the 3.9 branch. |
…pythonGH-23447) (cherry picked from commit 453bc1d) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
|
GH-23454 is a backport of this pull request to the 3.8 branch. |
https://bugs.python.org/issue42426