test_socket.py failure

Steve Holden steve at holdenweb.com
Sun Jan 30 16:19:15 EST 2005


x2164 at mailcity.com wrote:
>      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
> 
> OK
> 
>  
>      Located the code for 'socket_getservbyname' in 
>      'Modules/socketmodule.c' where the call to the glibc
>      function 'getservbyname' is made: 
> 
>      Py_BEGIN_ALLOW_THREADS
>      sp = getservbyname(name, proto);
>      Py_END_ALLOW_THREADS
>      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
>      failure?
> 
>      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.
> 
Compiling from source requires you to indicate the features that you 
want compiled in. Without thread support, sockets din't work, so it 
looks like you need to configure threads in. IIRC you do this by editing 
the Modules.? file.

regards
  Steve



More information about the Python-list mailing list