summaryrefslogtreecommitdiffstats
path: root/Lib/sre_compile.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/sre_compile.py')
-rw-r--r--Lib/sre_compile.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/Lib/sre_compile.py b/Lib/sre_compile.py
index 1d59d7e..96f337a 100644
--- a/Lib/sre_compile.py
+++ b/Lib/sre_compile.py
@@ -428,12 +428,12 @@ def _compile_info(code, pattern, flags):
_compile_charset(charset, flags, code)
code[skip] = len(code) - skip
-STRING_TYPES = [type("")]
-
try:
- STRING_TYPES.append(type(unicode("")))
+ unicode
except NameError:
- pass
+ STRING_TYPES = type("")
+else:
+ STRING_TYPES = (type(""), type(unicode("")))
def _code(p, flags):
@@ -453,7 +453,7 @@ def _code(p, flags):
def compile(p, flags=0):
# internal: convert pattern list to internal format
- if type(p) in STRING_TYPES:
+ if isinstance(p, STRING_TYPES):
import sre_parse
pattern = p
p = sre_parse.parse(p, flags)