diff options
author | Just van Rossum <just@letterror.com> | 2003-07-02 20:03:04 (GMT) |
---|---|---|
committer | Just van Rossum <just@letterror.com> | 2003-07-02 20:03:04 (GMT) |
commit | 12723baceab61f8812d68575c962696cc4e77fa1 (patch) | |
tree | 6ca9be800da1a9e5f3900302f5e82b883edb0231 /Lib/sre.py | |
parent | 5e4e39f12a9ec71650e9d8296b1fb69831c808de (diff) | |
download | cpython-12723baceab61f8812d68575c962696cc4e77fa1.zip cpython-12723baceab61f8812d68575c962696cc4e77fa1.tar.gz cpython-12723baceab61f8812d68575c962696cc4e77fa1.tar.bz2 |
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.py | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -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) |