[New-bugs-announce] [issue1711] socket functions that should return unsigned int return signed int

Maarten Thibaut report at bugs.python.org
Sun Dec 30 22:30:45 CET 2007


New submission from Maarten Thibaut:

Socket library functions such as ntohs() return uint16_t, but inside
Python these return values show up as negative numbers. One possible fix
is to convert these return values using pack:

struct.unpack('H', struct.pack('h', ntohs(number)))[0] & 0xffff

----------
components: Library (Lib)
messages: 59047
nosy: mthibaut
severity: normal
status: open
title: socket functions that should return unsigned int return signed int

__________________________________
Tracker <report at bugs.python.org>
<http://bugs.python.org/issue1711>
__________________________________


More information about the New-bugs-announce mailing list