Skip to content

Commit

Permalink
[3.12] gh-83162: Rename re.error in idlelib (GH-101677) (#112987)
Browse files Browse the repository at this point in the history
Backport idlelib part of #101677 with simple rename.
  • Loading branch information
terryjreedy authored Dec 12, 2023
1 parent 54fcfbd commit fd3b894
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion Lib/idlelib/replace.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
and replace+find.
"""
import re
re.PatternError = re.error # New in 3.13.

from tkinter import StringVar, TclError

Expand Down Expand Up @@ -120,7 +121,7 @@ def _replace_expand(self, m, repl):
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:
Expand Down
3 changes: 2 additions & 1 deletion Lib/idlelib/searchengine.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -84,7 +85,7 @@ def getprog(self):
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
Expand Down

0 comments on commit fd3b894

Please sign in to comment.