summaryrefslogtreecommitdiff
path: root/paramiko/util.py
diff options
context:
space:
mode:
authorJeff Forcier <jeff@bitprophet.org>2023-01-09 21:47:53 -0500
committerJeff Forcier <jeff@bitprophet.org>2023-01-09 23:26:00 -0500
commit7b8106e67c51e71fc4074f7851bbaebed4d5be0c (patch)
tree04d3db018d9c6df53fdecbd73a0593e533039b1f /paramiko/util.py
parent76675c7c471c14ec0b3288cec2beaf400b757480 (diff)
downloadparamiko-7b8106e67c51e71fc4074f7851bbaebed4d5be0c.tar.gz
Remove or transmute all use of long()
- When wrapping literals: just go away - When wrapping variables whose values are already definitely integers (eg output of 'id()'): ditto - When wrapping variables of unknown provenance or which are definitely NOT integers: replaced with int()
Diffstat (limited to 'paramiko/util.py')
-rw-r--r--paramiko/util.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/paramiko/util.py b/paramiko/util.py
index c397a815..a9865ec3 100644
--- a/paramiko/util.py
+++ b/paramiko/util.py
@@ -36,7 +36,7 @@ from paramiko.config import SSHConfig
def inflate_long(s, always_positive=False):
"""turns a normalized byte string into a long-int
(adapted from Crypto.Util.number)"""
- out = long(0)
+ out = 0
negative = 0
if not always_positive and (len(s) > 0) and (byte_ord(s[0]) >= 0x80):
negative = 1
@@ -50,7 +50,7 @@ def inflate_long(s, always_positive=False):
for i in range(0, len(s), 4):
out = (out << 32) + struct.unpack(">I", s[i : i + 4])[0]
if negative:
- out -= long(1) << (8 * len(s))
+ out -= 1 << (8 * len(s))
return out
@@ -59,7 +59,7 @@ def deflate_long(n, add_sign_padding=True):
(adapted from Crypto.Util.number)"""
# after much testing, this algorithm was deemed to be the fastest
s = bytes()
- n = long(n)
+ n = int(n)
while (n != 0) and (n != -1):
s = struct.pack(">I", n & xffffffff) + s
n >>= 32