This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author morrowc
Recipients dmorr, giampaolo.rodola, morrowc
Date 2008-12-30.06:08:47
SpamBayes Score 9.17756e-06
Marked as misclassified No
Message-id <1230617330.65.0.87253559937.issue1664@psf.upfronthosting.co.za>
In-reply-to
Content
a possible fix for 2.5 is:

morrowc@tweezer:/tmp$ diff -U3 nntplib.py.orig nntplib.py
--- nntplib.py.orig     2008-12-30 01:06:14.000000000 -0500
+++ nntplib.py  2008-12-30 01:07:33.000000000 -0500
@@ -109,8 +109,19 @@
         """
         self.host = host
         self.port = port
-        self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
-        self.sock.connect((self.host, self.port))
+        msg = "getaddrinfo returns an empty list"
+        for res in socket.getaddrinfo(self.host, self.port, 0, 
socket.SOCK_STREAM):
+          af, socktype, proto, canonname, sa = res
+          sock = None
+          try:
+            self.sock = socket.socket(af, socktype, proto)
+            self.sock.connect(sa)
+
+          except error, msg:
+            if self.sock is not None:
+                self.sock.close()
+            raise NNTPError, msg
+
         self.file = self.sock.makefile('rb')
         self.debugging = 0
         self.welcome = self.getresp()


I'll open a bug against 2.5 now with this.
History
Date User Action Args
2008-12-30 06:08:50morrowcsetrecipients: + morrowc, giampaolo.rodola, dmorr
2008-12-30 06:08:50morrowcsetmessageid: <1230617330.65.0.87253559937.issue1664@psf.upfronthosting.co.za>
2008-12-30 06:08:48morrowclinkissue1664 messages
2008-12-30 06:08:47morrowccreate