Kaydet (Commit) 3a53fbbf authored tarafından Benjamin Peterson's avatar Benjamin Peterson

#3911 FTP.makeport was giving bad port numbers

reviewed by Benjamin and Antoine
üst be17a117
...@@ -254,7 +254,7 @@ class FTP: ...@@ -254,7 +254,7 @@ class FTP:
port number. port number.
''' '''
hbytes = host.split('.') hbytes = host.split('.')
pbytes = [repr(port/256), repr(port%256)] pbytes = [repr(port//256), repr(port%256)]
bytes = hbytes + pbytes bytes = hbytes + pbytes
cmd = 'PORT ' + ','.join(bytes) cmd = 'PORT ' + ','.join(bytes)
return self.voidcmd(cmd) return self.voidcmd(cmd)
......
...@@ -348,7 +348,7 @@ class TestFTPClass(TestCase): ...@@ -348,7 +348,7 @@ class TestFTPClass(TestCase):
self.client.dir(lambda x: l.append(x)) self.client.dir(lambda x: l.append(x))
self.assertEqual(''.join(l), LIST_DATA.replace('\r\n', '')) self.assertEqual(''.join(l), LIST_DATA.replace('\r\n', ''))
def Xtest_makeport(self): def test_makeport(self):
self.client.makeport() self.client.makeport()
# IPv4 is in use, just make sure send_eprt has not been used # IPv4 is in use, just make sure send_eprt has not been used
self.assertEqual(self.server.handler.last_received_cmd, 'port') self.assertEqual(self.server.handler.last_received_cmd, 'port')
......
...@@ -22,6 +22,8 @@ Core and Builtins ...@@ -22,6 +22,8 @@ Core and Builtins
Library Library
------- -------
- Issue #3911: ftplib.FTP.makeport() could give invalid port numbers.
- Issue #3929: When the database cannot be opened, dbm.open() would incorrectly - Issue #3929: When the database cannot be opened, dbm.open() would incorrectly
raise a TypeError: "'tuple' object is not callable" instead of the expected raise a TypeError: "'tuple' object is not callable" instead of the expected
dbm.error. dbm.error.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment