[issue1664] nntplib is not IPv6-capable

2008-12-29 Thread Chris Morrow

Chris Morrow  added the comment:

This patch doesn't appear to work for python2.5.1 ->

Python 2.5.1 (r251:54863, Jun 15 2008, 18:24:51) 
[GCC 4.3.0 20080428 (Red Hat 4.3.0-8)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from nntplib import NNTP
>>> conn = NNTP('newszilla6.xs4all.nl')
Traceback (most recent call last):
  File "", line 1, in 
  File "/usr/lib/python2.5/nntplib.py", line 114, in __init__
self.sock = socket.create_connection((host, port))
AttributeError: 'module' object has no attribute 'create_connection'


(at least for me it doesn't work...
Linux hostnamehere 2.6.26.6-79.fc9.i686 #1 SMP Fri Oct 17 14:52:14 EDT 
2008 i686 i686 i386 GNU/Linux)

I'd be happy to try something else, or debug in other ways it that'd 
help... This really ought to get fixed if possible.

--
nosy: +morrowc

___
Python tracker 
<http://bugs.python.org/issue1664>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1664] nntplib is not IPv6-capable

2008-12-29 Thread Chris Morrow

Chris Morrow  added the comment:

oh crap :( I saw the 2.6 AFTER I posted the message :( sorry. grr, have 
to find a fix for 2.5 I suppose now.

Thanks.

___
Python tracker 
<http://bugs.python.org/issue1664>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1664] nntplib is not IPv6-capable

2008-12-29 Thread Chris Morrow

Chris Morrow  added the comment:

oy, and I'm not reading emails properly. I'll try the fix you propose 
for 2.5.

___
Python tracker 
<http://bugs.python.org/issue1664>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1664] nntplib is not IPv6-capable

2008-12-29 Thread Chris Morrow

Chris Morrow  added the comment:

a possible fix for 2.5 is:

morr...@tweezer:/tmp$ diff -U3 nntplib.py.orig nntplib.py
--- nntplib.py.orig 2008-12-30 01:06:14.0 -0500
+++ nntplib.py  2008-12-30 01:07:33.0 -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.

___
Python tracker 
<http://bugs.python.org/issue1664>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4777] nntplib - python 2.5

2008-12-29 Thread Chris Morrow

New submission from Chris Morrow :

nntplib.py on python2.5 is not IPv6 ready. The below patch at least 
makes connections on both ipv4 and ipv6 to servers.

This was taken out of bug: http://bugs.python.org/issue1664

if that helps...

platform: 
Linux hostnamehere 2.6.26.6-79.fc9.i686 #1 SMP Fri Oct 17 14:52:14 EDT 
2008 i686 i686 i386 GNU/Linux


morr...@tweezer:/tmp$ diff -U3 nntplib.py.orig nntplib.py
--- nntplib.py.orig 2008-12-30 01:06:14.0 -0500
+++ nntplib.py  2008-12-30 01:07:33.0 -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()

--
components: Library (Lib)
files: nntplib.py-ipv6.patch
keywords: patch
messages: 78509
nosy: morrowc
severity: normal
status: open
title: nntplib - python 2.5
type: behavior
versions: Python 2.5
Added file: http://bugs.python.org/file12489/nntplib.py-ipv6.patch

___
Python tracker 
<http://bugs.python.org/issue4777>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1664] nntplib is not IPv6-capable

2008-12-30 Thread Chris Morrow

Chris Morrow  added the comment:

Are we sure that the 2.6 fix (in the patch) will make it into 2.6? (and 
the right upstream patching will happen to the 3.0 code as well?)

___
Python tracker 
<http://bugs.python.org/issue1664>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1664] nntplib is not IPv6-capable

2009-04-01 Thread Chris Morrow

Chris Morrow  added the comment:

This is a little silly and painful... it's utterly broken to hardcode
the AF type in this way, could we please apply a patch (something like
the proposed seems to work fine) and get this rolled into the next release? 

It seems really lame to not be able to support normal internet protocols
in a tools language.

--

___
Python tracker 
<http://bugs.python.org/issue1664>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com