[Python-Dev] New test failure, test_socket, WinXP

Tim Peters tim.one at comcast.net
Tue Jul 6 06:01:38 CEST 2004


>> Fails every time, in release and debug builds:
>>
>> test test_socket failed -- Traceback (most recent call last):
>> File "C:\Code\python\lib\test\test_socket.py", line 311, in testGetServBy
>>     eq(socket.getservbyport(port2), service)
>> AssertionError: 'http' != 'www'

> Sounds like the Windows equivalent (on your box) of /etc/services is
> bogus.  What does the line for 80/tcp look like in
> \Wimdows\system32\drivers\etc\services ?  (Well, that's where it is on my
> XP box.  Who knows where it is on yours.)
>
> On my box it says approximately:
>
> http  80/tcp   www   www-http         #world wide web

On mine it is exactly:

http               80/tcp    www www-http           #World Wide Web

> This suggests that it should return "http", not "www" --

Well, to judge from the failing assert in isolation, getservbyport() is
returning "http", but the test expects "www" ... yup:

Python 2.4a0 (#46, Jul  5 2004, 18:32:20) [MSC v.1310 32 bit (Intel)] on
win32
>>> import socket
>>> socket.getservbyname('www', 'tcp')
80
>>> socket.getservbyport(_)
'http'
>>>

The other name are accepted too:

>>> socket.getservbyname('http', 'tcp')
80
>>> socket.getservbyname('www-http', 'tcp')
80
>>>




More information about the Python-Dev mailing list