-
-
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -84,20 +84,17 @@ def getprog(self): | |
flags = flags | re.IGNORECASE | ||
try: | ||
prog = re.compile(pat, flags) | ||
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 commentThe reason will be displayed to describe this comment to others. Learn more. This was my 'fix' for the original 2020 code that had |
||
self.report_error(pat, msg, col) | ||
except re.error as e: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I like the change to 'e' and simplification of code. |
||
self.report_error(pat, e.msg, e.pos) | ||
return None | ||
return prog | ||
|
||
def report_error(self, pat, msg, col=-1): | ||
def report_error(self, pat, msg, col=None): | ||
# Derived class could override this with something fancier | ||
msg = "Error: " + str(msg) | ||
if pat: | ||
msg = msg + "\nPattern: " + str(pat) | ||
if col >= 0: | ||
if col is not None: | ||
msg = msg + "\nOffset: " + str(col) | ||
tkMessageBox.showerror("Regular expression error", | ||
msg, master=self.root) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Fix reporting offset of the RE error in searchengine. |
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.