-
-
Notifications
You must be signed in to change notification settings - Fork 31.9k
bpo-42426: IDLE: Fix reporting offset of the RE error in searchengine #23447
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bpo-42426: IDLE: Fix reporting offset of the RE error in searchengine #23447
Conversation
9360904
to
8a96705
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.setpat('+') | ||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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