Skip to content

[3.11] [3.12] gh-83162: Rename re.error in idlelib (GH-101677) (GH-112987) #113013

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

Merged
merged 1 commit into from
Dec 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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