From 4f64f42b46147394b8f085936f5566024940e8c8 Mon Sep 17 00:00:00 2001 From: Terry Jan Reedy Date: Tue, 12 Dec 2023 10:53:58 -0500 Subject: [PATCH] [3.12] gh-83162: Rename re.error in idlelib (GH-101677) (GH-112987) Backport idlelib part of GH-101677 with simple rename. (cherry picked from commit fd3b8947256309ba478a4e3ba8c0c81b1260b67f) Co-authored-by: Terry Jan Reedy --- Lib/idlelib/replace.py | 3 ++- 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 a29ca591427491..71e187f9279231 100644 --- a/Lib/idlelib/replace.py +++ b/Lib/idlelib/replace.py @@ -4,6 +4,7 @@ and replace+find. """ import re +re.PatternError = re.error # New in 3.13. from tkinter import StringVar, TclError @@ -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: diff --git a/Lib/idlelib/searchengine.py b/Lib/idlelib/searchengine.py index 0684142f43644a..5119de05865b7a 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 @@ 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 pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy