forked from orbit-oss/flask
Merge pull request #3082 from cclauss/patch-2
_compat.py: Use feature detection instead of version detection
This commit is contained in:
commit
0b5b4a66ef
1 changed files with 6 additions and 6 deletions
|
|
@ -16,12 +16,16 @@ import sys
|
|||
PY2 = sys.version_info[0] == 2
|
||||
_identity = lambda x: x
|
||||
|
||||
|
||||
if not PY2:
|
||||
try: # Python 2
|
||||
text_type = unicode
|
||||
string_types = (str, unicode)
|
||||
integer_types = (int, long)
|
||||
except NameError: # Python 3
|
||||
text_type = str
|
||||
string_types = (str,)
|
||||
integer_types = (int,)
|
||||
|
||||
if not PY2:
|
||||
iterkeys = lambda d: iter(d.keys())
|
||||
itervalues = lambda d: iter(d.values())
|
||||
iteritems = lambda d: iter(d.items())
|
||||
|
|
@ -38,10 +42,6 @@ if not PY2:
|
|||
implements_to_string = _identity
|
||||
|
||||
else:
|
||||
text_type = unicode
|
||||
string_types = (str, unicode)
|
||||
integer_types = (int, long)
|
||||
|
||||
iterkeys = lambda d: d.iterkeys()
|
||||
itervalues = lambda d: d.itervalues()
|
||||
iteritems = lambda d: d.iteritems()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue