diff options
author | Terry Jan Reedy <tjreedy@udel.edu> | 2023-12-12 15:53:58 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-12-12 15:53:58 (GMT) |
commit | fd3b8947256309ba478a4e3ba8c0c81b1260b67f (patch) | |
tree | 44128fd5c9925caa5afa11c7f70d07a790c98fce /Lib/idlelib | |
parent | 54fcfbde300e9c909b56cc67ceac4700ff28ecee (diff) | |
download | cpython-fd3b8947256309ba478a4e3ba8c0c81b1260b67f.zip cpython-fd3b8947256309ba478a4e3ba8c0c81b1260b67f.tar.gz cpython-fd3b8947256309ba478a4e3ba8c0c81b1260b67f.tar.bz2 |
[3.12] gh-83162: Rename re.error in idlelib (GH-101677) (#112987)
Backport idlelib part of #101677 with simple rename.
Diffstat (limited to 'Lib/idlelib')
-rw-r--r-- | Lib/idlelib/replace.py | 3 | ||||
-rw-r--r-- | Lib/idlelib/searchengine.py | 3 |
2 files changed, 4 insertions, 2 deletions
diff --git a/Lib/idlelib/replace.py b/Lib/idlelib/replace.py index a29ca59..71e187f 100644 --- a/Lib/idlelib/replace.py +++ b/Lib/idlelib/replace.py @@ -4,6 +4,7 @@ Defines various replace related functions like replace, replace all, and replace+find. """ import re +re.PatternError = re.error # New in 3.13. from tkinter import StringVar, TclError @@ -120,7 +121,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: diff --git a/Lib/idlelib/searchengine.py b/Lib/idlelib/searchengine.py index 0684142..5119de0 100644 --- a/Lib/idlelib/searchengine.py +++ b/Lib/idlelib/searchengine.py @@ -1,5 +1,6 @@ '''Define SearchEngine for search dialogs.''' import re +re.PatternError = re.error # New in 3.13. from tkinter import StringVar, BooleanVar, TclError from tkinter import messagebox @@ -84,7 +85,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 |