This is just a post for the record for myself since I didnt fully understand every part of the issue and most recent computers all have IPv6 enabled.

Just a day or two ago, I upgraded Google App Engine to 1.7.7 from 1.7.6 and it threw this error:

 ~/p/yjl.im [hg:default] $ make run
google_appengine/dev_appserver.py --enable_sendmail yes src
Traceback (most recent call last):
  File "google_appengine/dev_appserver.py", line 193, in <module>
    _run_file(__file__, globals())
  File "google_appengine/dev_appserver.py", line 189, in _run_file
    execfile(script_path, globals_)
  File "/home/livibetter/p/google_appengine/google/appengine/tools/devappserver2/devappserver2.py", line 662, in <module>
    main()
  File "/home/livibetter/p/google_appengine/google/appengine/tools/devappserver2/devappserver2.py", line 655, in main
    dev_server.start(options)
  File "/home/livibetter/p/google_appengine/google/appengine/tools/devappserver2/devappserver2.py", line 626, in start
    apis.start()
  File "/home/livibetter/p/google_appengine/google/appengine/tools/devappserver2/api_server.py", line 151, in start
    super(APIServer, self).start()
  File "/home/livibetter/p/google_appengine/google/appengine/tools/devappserver2/wsgi_server.py", line 289, in start
    server.start()
  File "/home/livibetter/p/google_appengine/google/appengine/tools/devappserver2/wsgi_server.py", line 190, in start
    socket.SOCK_STREAM, 0, socket.AI_PASSIVE)
TypeError: getaddrinfo() argument 1 must be string or None
Exception in thread Thread-4 (most likely raised during interpreter shutdown):
Traceback (most recent call last):
make: *** [run] Error 1

At first, I thought maybe some system updates interferred, so I checked logs, Python was untoched nor any system packages. There was no installs or uninstalls. I searched for issues, documentations, discussions, Stack Overflow, not a single entry posted after the release of 1.7.7 having the same error message I got.

Finally, I printed out the host and port to see whats going on, they had some unusual values:

10
'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'

If compared with the following code:

socket.getaddrinfo('localhost', 0, socket.AF_UNSPEC, socket.SOCK_STREAM, 0, socket.AI_PASSIVE)

[(2, 1, 6, '', ('127.0.0.1', 0)), (10, 1, 6, '', (10, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'))]

You can see where the values came from. According to Python socket:

[] (results may differ on your system if IPv6 isnt enabled):

and getaddrinfo(3):

[] and no matching IPv6 addresses could be found, then return IPv4-mapped IPv6 addresses in the list pointed to by res. []

I think that 14 bytes of all 0s might have something to do with IPv4-mapped IPv6 address since I dont have IPv6 enabled. I feel the values of Pythons socket.getaddinfo look like an erroneous result.

At this moment, just a quick workaround, I replaced AF_UNSPEC with AF_INET in line 276 for IPv4 only. I think this sort of counts as a bug, but I am not sure if it is worth to report and to be patched.

This could be a sign that its time for me to migrate to IPv6, I now have added ipv6 USE flag added in make.conf. I will let packages slowly being built with IPv6 support.