[Python-checkins] python/dist/src/Lib sre.py,1.46,1.47 sre_compile.py,1.48,1.49
jvr@users.sourceforge.net
jvr@users.sourceforge.net
Wed, 02 Jul 2003 14:37:18 -0700
Update of /cvsroot/python/python/dist/src/Lib
In directory sc8-pr-cvs1:/tmp/cvs-serv10352/Lib
Modified Files:
sre.py sre_compile.py
Log Message:
Addendum to #764548: restore 2.1 compatibility.
Index: sre.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/sre.py,v
retrieving revision 1.46
retrieving revision 1.47
diff -C2 -d -r1.46 -r1.47
*** sre.py 2 Jul 2003 20:03:04 -0000 1.46
--- sre.py 2 Jul 2003 21:37:16 -0000 1.47
***************
*** 222,226 ****
if isinstance(pattern, _pattern_type):
return pattern
! if not isinstance(pattern, sre_compile.STRING_TYPES):
raise TypeError, "first argument must be string or compiled pattern"
try:
--- 222,226 ----
if isinstance(pattern, _pattern_type):
return pattern
! if not sre_compile.isstring(pattern):
raise TypeError, "first argument must be string or compiled pattern"
try:
Index: sre_compile.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/sre_compile.py,v
retrieving revision 1.48
retrieving revision 1.49
diff -C2 -d -r1.48 -r1.49
*** sre_compile.py 2 Jul 2003 20:03:04 -0000 1.48
--- sre_compile.py 2 Jul 2003 21:37:16 -0000 1.49
***************
*** 432,439 ****
unicode
except NameError:
! STRING_TYPES = type("")
else:
STRING_TYPES = (type(""), type(unicode("")))
def _code(p, flags):
--- 432,445 ----
unicode
except NameError:
! STRING_TYPES = (type(""),)
else:
STRING_TYPES = (type(""), type(unicode("")))
+ def isstring(obj):
+ for tp in STRING_TYPES:
+ if isinstance(obj, tp):
+ return 1
+ return 0
+
def _code(p, flags):
***************
*** 454,458 ****
# internal: convert pattern list to internal format
! if isinstance(p, STRING_TYPES):
import sre_parse
pattern = p
--- 460,464 ----
# internal: convert pattern list to internal format
! if isstring(p):
import sre_parse
pattern = p