[Python-checkins] cpython (2.7): Issue #18050: Fixed an incompatibility of the re module with Python 2.7.3

serhiy.storchaka python-checkins at python.org
Fri Sep 20 20:30:36 CEST 2013


http://hg.python.org/cpython/rev/f27af2243e2a
changeset: 85759:f27af2243e2a
branch: 2.7
parent: 85750:88e62c43e443
user: Serhiy Storchaka <storchaka at gmail.com>
date: Fri Sep 20 21:25:53 2013 +0300
summary:
 Issue #18050: Fixed an incompatibility of the re module with Python 2.7.3
and older binaries.
files:
 Lib/sre_compile.py | 1 -
 Lib/sre_constants.py | 6 +++++-
 Lib/sre_parse.py | 1 -
 Misc/NEWS | 3 +++
 4 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/Lib/sre_compile.py b/Lib/sre_compile.py
--- a/Lib/sre_compile.py
+++ b/Lib/sre_compile.py
@@ -13,7 +13,6 @@
 import _sre, sys
 import sre_parse
 from sre_constants import *
-from _sre import MAXREPEAT
 
 assert _sre.MAGIC == MAGIC, "SRE module mismatch"
 
diff --git a/Lib/sre_constants.py b/Lib/sre_constants.py
--- a/Lib/sre_constants.py
+++ b/Lib/sre_constants.py
@@ -15,7 +15,11 @@
 
 MAGIC = 20031017
 
-from _sre import MAXREPEAT
+try:
+ from _sre import MAXREPEAT
+except ImportError:
+ import _sre
+ MAXREPEAT = _sre.MAXREPEAT = 65535
 
 # SRE standard exception (access as sre.error)
 # should this really be here?
diff --git a/Lib/sre_parse.py b/Lib/sre_parse.py
--- a/Lib/sre_parse.py
+++ b/Lib/sre_parse.py
@@ -15,7 +15,6 @@
 import sys
 
 from sre_constants import *
-from _sre import MAXREPEAT
 
 SPECIAL_CHARS = ".\\[{()*+?^$|"
 REPEAT_CHARS = "*+?{"
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -32,6 +32,9 @@
 Library
 -------
 
+- Issue #18050: Fixed an incompatibility of the re module with Python 2.7.3
+ and older binaries.
+
 - Issue #19037: The mailbox module now makes all changes to maildir files
 before moving them into place, to avoid race conditions with other programs
 that may be accessing the maildir directory.
-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /