summaryrefslogtreecommitdiff
path: root/Lib/sre.py
diff options
context:
space:
mode:
authorJust van Rossum <just@letterror.com>2003-07-02 20:03:04 +0000
committerJust van Rossum <just@letterror.com>2003-07-02 20:03:04 +0000
commitaf9fce7dd07ba533bf53b94933b3dfd5bcca5931 (patch)
tree7d197de9a3fcdd2529bf3f1e922570485322ac5d /Lib/sre.py
parenta8ac59aa5ea1b695da2ad32a183d2ee935f12449 (diff)
downloadcpython-af9fce7dd07ba533bf53b94933b3dfd5bcca5931.tar.gz
Fix and test for bug #764548:
Use isinstance() instead of comparing types directly, to enable subclasses of str and unicode to be used as patterns. Blessed by /F.
Diffstat (limited to 'Lib/sre.py')
-rw-r--r--Lib/sre.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/Lib/sre.py b/Lib/sre.py
index 7e107a68fd..7910c83eac 100644
--- a/Lib/sre.py
+++ b/Lib/sre.py
@@ -219,9 +219,9 @@ def _compile(*key):
if p is not None:
return p
pattern, flags = key
- if type(pattern) is _pattern_type:
+ if isinstance(pattern, _pattern_type):
return pattern
- if type(pattern) not in sre_compile.STRING_TYPES:
+ if not isinstance(pattern, sre_compile.STRING_TYPES):
raise TypeError, "first argument must be string or compiled pattern"
try:
p = sre_compile.compile(pattern, flags)