[Python 3]: Added fix for enabling proper adding of integers under both Python 2 and 3.
This commit is contained in:
parent
3c33c763a7
commit
9ffd9efb20
|
@ -20,11 +20,15 @@
|
|||
Implementation of an SSH2 "message".
|
||||
"""
|
||||
|
||||
|
||||
import struct
|
||||
try:
|
||||
from cStringIO import StringIO
|
||||
except ImportError:
|
||||
from io import StringIO
|
||||
import six
|
||||
if six.PY3:
|
||||
long = lambda x: int(x)
|
||||
|
||||
from paramiko import util
|
||||
|
||||
|
@ -277,13 +281,17 @@ class Message (object):
|
|||
def _add(self, i):
|
||||
if type(i) is str:
|
||||
return self.add_string(i)
|
||||
elif type(i) is int:
|
||||
|
||||
elif type(i) in six.integer_types:
|
||||
|
||||
if type(i) is int and not six.PY3:
|
||||
return self.add_int(i)
|
||||
elif type(i) is long:
|
||||
else:
|
||||
if i > long(0xffffffff):
|
||||
return self.add_mpint(i)
|
||||
else:
|
||||
return self.add_int(i)
|
||||
|
||||
elif type(i) is bool:
|
||||
return self.add_boolean(i)
|
||||
elif type(i) is list:
|
||||
|
|
Loading…
Reference in New Issue