[Python-bugs-list] [ python-Bugs-445984 ] test___all__ fails when _socket absent

noreply@sourceforge.net noreply@sourceforge.net
Sat, 04 Aug 2001 10:43:57 -0700


Bugs item #445984, was opened at 2001-07-30 08:28
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=445984&group_id=5470

Category: Python Library
Group: Platform-specific
Status: Open
Resolution: None
Priority: 5
Submitted By: Greg Ward (gward)
Assigned to: Greg Ward (gward)
Summary: test___all__ fails when _socket absent

Initial Comment:
If the _socket extension couldn't be built (see bug
#445980), test___all__ fails somewhat mysteriously:

$ ./python Lib/test/test___all__.py
Traceback (most recent call last):
  File "Lib/test/test___all__.py", line 42, in ?
    check_all("CGIHTTPServer")
  File "Lib/test/test___all__.py", line 10, in check_all
    exec "import %s" % modname in names
  File "<string>", line 1, in ?
  File "/tmp/Python-2.2a1/Lib/CGIHTTPServer.py", line
27, in ?
    import BaseHTTPServer
  File "/tmp/Python-2.2a1/Lib/BaseHTTPServer.py", line
72, in ?
    import SocketServer
  File "/tmp/Python-2.2a1/Lib/SocketServer.py", line
273, in ?
    class TCPServer(BaseServer):
  File "/tmp/Python-2.2a1/Lib/SocketServer.py", line
316, in TCPServer
    address_family = socket.AF_INET
AttributeError: 'module' object has no attribute 'AF_INET'



----------------------------------------------------------------------

>Comment By: Guido van Rossum (gvanrossum)
Date: 2001-08-04 10:43

Message:
Logged In: YES 
user_id=6380

Sounds good to me.

----------------------------------------------------------------------

Comment By: Greg Ward (gward)
Date: 2001-08-04 10:07

Message:
Logged In: YES 
user_id=14422

Guido's "fix" is close -- you actually have to
"import _socket" (trigger an ImportError) before
check_all("CGIHTTPServer"), because it imports socket.

With that "fix" made, the test result is:

  test test___all__ skipped --  No module named _socket

Should I check this in (one "import _socket" line added to test___all__.py)?  Or is this too arcane, ie. you're toast if _socket doesn't build, so don't bother trying to workaround it?


----------------------------------------------------------------------

Comment By: Guido van Rossum (gvanrossum)
Date: 2001-07-30 08:50

Message:
Logged In: YES 
user_id=6380

This can be "fixed" by inserting "import _socket" in front
of the check_all("socket") line.

----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=445984&group_id=5470