This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author gvanrossum
Recipients
Date 2003-09-23.17:23:47
SpamBayes Score
Marked as misclassified
Message-id
In-reply-to
Content
On Solaris, socket.ntohs() can return a negative number
when the argument has bit 15 set. This is not according
to spec or intention or expectation. The bug is because
on Solaris, ntohs() is defined as a macro that returns
its argument unchanged, roughly:

  #define ntohs(x) (x)

The socket extension casts the argument to (short); it
should use (unsigned short) or something similar.

Here's a program showing the problem (run this on
Solaris, or on another big-endian machine where ntohs()
is defined away):

import socket
print socket.ntohs(-1)

This should print 65535 but prints -1.

(Credit to Andrew Davis for finding this!)
History
Date User Action Args
2008-01-20 09:56:25adminlinkissue811295 messages
2008-01-20 09:56:25admincreate