summaryrefslogtreecommitdiff
path: root/Lib/re.py
diff options
context:
space:
mode:
authorÉric Araujo <merwok@netwok.org>2011-09-03 00:48:17 +0200
committerÉric Araujo <merwok@netwok.org>2011-09-03 00:48:17 +0200
commit4778b90a1f0e8f8ca31a733177a7a210fed8b501 (patch)
tree76f9265f99d66c31534f753ac2151fc3464fd3f5 /Lib/re.py
parentc256a757f82ef3963d137244373be69c97660fac (diff)
parent012b6d0d240ce5dc0300053f1d54b07a1a475680 (diff)
downloadcpython-4778b90a1f0e8f8ca31a733177a7a210fed8b501.tar.gz
Merge fix for #8286 from 3.2
Diffstat (limited to 'Lib/re.py')
-rw-r--r--Lib/re.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/Lib/re.py b/Lib/re.py
index abd7ea27b3..cdf597627f 100644
--- a/Lib/re.py
+++ b/Lib/re.py
@@ -215,12 +215,14 @@ def template(pattern, flags=0):
return _compile(pattern, flags|T)
_alphanum_str = frozenset(
- "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890")
+ "_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890")
_alphanum_bytes = frozenset(
- b"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890")
+ b"_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890")
def escape(pattern):
- "Escape all non-alphanumeric characters in pattern."
+ """
+ Escape all the characters in pattern except ASCII letters, numbers and '_'.
+ """
if isinstance(pattern, str):
alphanum = _alphanum_str
s = list(pattern)