Fix uses of retired builtins and builtin methods

In Python 3.x

- int and long types are unified. The unified type is called int.
- the text string type (unicode) is renamed to str.
- the byte string type (str) is renamed to bytes.
- chr returns a text string (i.e. str)
- xrange is renamed to range.
- dict.has_key() is removed
-
This commit is contained in:
Alex Willmer 2019-05-10 21:28:35 +01:00
parent 0f3cadcc3e
commit 287f71d561
4 changed files with 33 additions and 20 deletions

View file

@ -28,7 +28,7 @@ import hammer as h
def bsfdig_value(p):
"""Return the numeric value of a parsed base64 digit.
"""
c = p if isinstance(p, (int, long)) else ord(p)
c = p if isinstance(p, h.INTEGER_TYPES) else ord(p)
if c:
if 0x41 <= c <= 0x5A: # A-Z
return c - 0x41