Argument to struct.pack must be a string not unicode.

This commit is contained in:
Gareth J. Greenaway 2018-01-26 13:42:46 -08:00
parent e2b8ec9255
commit ec86cfde0e
No known key found for this signature in database
GPG Key ID: 10B62F8A7CAD7A41

View File

@ -708,7 +708,7 @@ class Terminal(object):
def __detect_parent_terminal_size(self): def __detect_parent_terminal_size(self):
try: try:
TIOCGWINSZ = getattr(termios, 'TIOCGWINSZ', 1074295912) TIOCGWINSZ = getattr(termios, 'TIOCGWINSZ', 1074295912)
packed = struct.pack('HHHH', 0, 0, 0, 0) packed = struct.pack(str('HHHH'), 0, 0, 0, 0) # future lint: blacklisted-function
ioctl = fcntl.ioctl(sys.stdin.fileno(), TIOCGWINSZ, packed) ioctl = fcntl.ioctl(sys.stdin.fileno(), TIOCGWINSZ, packed)
return struct.unpack('HHHH', ioctl)[0:2] return struct.unpack('HHHH', ioctl)[0:2]
except IOError: except IOError: