test_socket.py failure

x2164 at mailcity.com x2164 at mailcity.com
Sun Jan 30 08:35:27 EST 2005

     hi all,

     Linux 2.4.28
     Glibc 2.2.5
     gcc   2.95.3

     I'm new to Python.

     I've compiled Python 2.4 from tar file.

     When running 'make test' i'm getting a failure
     in test_socket.

     Running './python Lib/test/test_socket.py' yields:

ERROR: testGetServBy (__main__.GeneralModuleTests)
Traceback (most recent call last):
  File "Lib/test/test_socket.py", line 330, in testGetServBy
    port2 = socket.getservbyname(service)
error: service/proto not found

Ran 58 tests in 3.826s

     The value of 'service' was "daytime".

     After much hand wringing, editing, and use of 'print'
     statements i commented out line 330,
     '# port2 = socket.getservbyname(service)' and replaced it
     with the line 'port2 = port'.

     Running './python Lib/test/test_socket.py' now yields:

testGetServBy (__main__.GeneralModuleTests) ... ok
Ran 58 tests in 5.181s


     Located the code for 'socket_getservbyname' in 
     'Modules/socketmodule.c' where the call to the glibc
     function 'getservbyname' is made: 

     sp = getservbyname(name, proto);
     if (sp == NULL) {
	     PyErr_SetString(socket_error, "service/proto not found");
	     return NULL;

     The only call of socket.getservbyname that failed was when
     it was passed the single argument.  Since the error message
     "service/proto not found" seems to only be generated upon
     failure of gibc's 'getservbyname' could it be that 
     'PyArg_ParseTuple(args, "s|s:getservbyname", &name, &proto)'
     generates values for 'name' and/or 'proto' that cause the

     My search for prior reports of failure at line 330 found
     a mention of problems at line 331.

     Well, at any rate, if someone could point me down the 
     correct path on this i would appreciate it.

     pete jordan
     x2164 -> mailcity.com
     -> equals at symbol


More information about the Python-list mailing list