GH-83162: Rename re.error for better clarity. (#101677)

Renamed re.error for clarity, and kept re.error for backward compatibility.
Updated idlelib files at TJR's request.
---------

Co-authored-by: Matthias Bussonnier <mbussonnier@ucmerced.edu>
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
This commit is contained in:
achhina 2023-12-11 15:45:08 -05:00 committed by GitHub
parent 0066ab5bc5
commit a01022af23
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 53 additions and 34 deletions

View file

@ -120,7 +120,7 @@ class ReplaceDialog(SearchDialogBase):
if self.engine.isre():
try:
new = m.expand(repl)
except re.error:
except re.PatternError:
self.engine.report_error(repl, 'Invalid Replace Expression')
new = None
else:

View file

@ -84,7 +84,7 @@ class SearchEngine:
flags = flags | re.IGNORECASE
try:
prog = re.compile(pat, flags)
except re.error as e:
except re.PatternError as e:
self.report_error(pat, e.msg, e.pos)
return None
return prog