Skip to content

Commit 11f9502

Browse files
[3.11] [3.12] gh-83162: Rename re.error in idlelib (GH-101677) (GH-112987) (#113013)
Backport idlelib part of GH-101677 with simple rename. (cherry picked from commit fd3b894) Co-authored-by: Terry Jan Reedy <[email protected]>
1 parent f83087c commit 11f9502

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

Lib/idlelib/replace.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
and replace+find.
55
"""
66
import re
7+
re.PatternError = re.error # New in 3.13.
78

89
from tkinter import StringVar, TclError
910

@@ -120,7 +121,7 @@ def _replace_expand(self, m, repl):
120121
if self.engine.isre():
121122
try:
122123
new = m.expand(repl)
123-
except re.error:
124+
except re.PatternError:
124125
self.engine.report_error(repl, 'Invalid Replace Expression')
125126
new = None
126127
else:

Lib/idlelib/searchengine.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
'''Define SearchEngine for search dialogs.'''
22
import re
3+
re.PatternError = re.error # New in 3.13.
34

45
from tkinter import StringVar, BooleanVar, TclError
56
from tkinter import messagebox
@@ -84,7 +85,7 @@ def getprog(self):
8485
flags = flags | re.IGNORECASE
8586
try:
8687
prog = re.compile(pat, flags)
87-
except re.error as e:
88+
except re.PatternError as e:
8889
self.report_error(pat, e.msg, e.pos)
8990
return None
9091
return prog

0 commit comments

Comments
 (0)