[Python-3000-checkins] r66656 - in python/branches/py3k: Lib/ftplib.py Lib/test/test_ftplib.py Misc/NEWS

benjamin.peterson python-3000-checkins at python.org
Sun Sep 28 00:04:16 CEST 2008


Author: benjamin.peterson
Date: Sun Sep 28 00:04:16 2008
New Revision: 66656

Log:
#3911 FTP.makeport was giving bad port numbers

reviewed by Benjamin and Antoine


Modified:
   python/branches/py3k/Lib/ftplib.py
   python/branches/py3k/Lib/test/test_ftplib.py
   python/branches/py3k/Misc/NEWS

Modified: python/branches/py3k/Lib/ftplib.py
==============================================================================
--- python/branches/py3k/Lib/ftplib.py	(original)
+++ python/branches/py3k/Lib/ftplib.py	Sun Sep 28 00:04:16 2008
@@ -254,7 +254,7 @@
         port number.
         '''
         hbytes = host.split('.')
-        pbytes = [repr(port/256), repr(port%256)]
+        pbytes = [repr(port//256), repr(port%256)]
         bytes = hbytes + pbytes
         cmd = 'PORT ' + ','.join(bytes)
         return self.voidcmd(cmd)

Modified: python/branches/py3k/Lib/test/test_ftplib.py
==============================================================================
--- python/branches/py3k/Lib/test/test_ftplib.py	(original)
+++ python/branches/py3k/Lib/test/test_ftplib.py	Sun Sep 28 00:04:16 2008
@@ -348,7 +348,7 @@
         self.client.dir(lambda x: l.append(x))
         self.assertEqual(''.join(l), LIST_DATA.replace('\r\n', ''))
 
-    def Xtest_makeport(self):
+    def test_makeport(self):
         self.client.makeport()
         # IPv4 is in use, just make sure send_eprt has not been used
         self.assertEqual(self.server.handler.last_received_cmd, 'port')

Modified: python/branches/py3k/Misc/NEWS
==============================================================================
--- python/branches/py3k/Misc/NEWS	(original)
+++ python/branches/py3k/Misc/NEWS	Sun Sep 28 00:04:16 2008
@@ -22,6 +22,8 @@
 Library
 -------
 
+- Issue #3911: ftplib.FTP.makeport() could give invalid port numbers.
+
 - Issue #3929: When the database cannot be opened, dbm.open() would incorrectly
   raise a TypeError: "'tuple' object is not callable" instead of the expected
   dbm.error.


More information about the Python-3000-checkins mailing list