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.

classification
Title: Add a "source_address" option to ftplib
Type: enhancement Stage:
Components: Library (Lib) Versions: Python 3.3
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: giampaolo.rodola Nosy List: giampaolo.rodola, nadeem.vawda, pitrou, python-dev, r.david.murray
Priority: normal Keywords: needs review, patch

Created on 2010-05-01 20:33 by giampaolo.rodola, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
ftplib_source_address.patch giampaolo.rodola, 2010-05-01 20:32 review
ftplib_source_address.patch giampaolo.rodola, 2011-02-26 18:26
test_ftplib-leak.diff nadeem.vawda, 2011-03-06 20:17
Messages (12)
msg104749 - (view) Author: Giampaolo Rodola' (giampaolo.rodola) * (Python committer) Date: 2010-05-01 20:32
Similarly to issue 3972 the patch in attachment adds a new "source_address" option to FTP class to bind to a specific address when connecting to a remote FTP server.

It must be noted that this gets done for both control and passive data connections (client connecting to server). The latter one solves issue 1661754.
msg104753 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2010-05-01 22:01
You should not use find_unused_port(), because it causes problems on some Windows buildbot. Also, there's something fishy in your patch, because you never set self.source_address.
msg104805 - (view) Author: Giampaolo Rodola' (giampaolo.rodola) * (Python committer) Date: 2010-05-02 21:36
> You should not use find_unused_port()

I agree find_unused_port() is the wrong approach in general, but in this case I think there's nothing we can do about it.

> you never set self.source_address.

You're right, I should set it in connect() method.
I'm going to attach a new patch including documentation.
msg129582 - (view) Author: Giampaolo Rodola' (giampaolo.rodola) * (Python committer) Date: 2011-02-26 18:26
Patch in attachment set source_address attribute and updates doc.
It still keeps using support.find_unused_port() which is also used in test_socket.py though [1], so it shouldn't cause problems.

http://svn.python.org/view/python/trunk/Lib/test/test_socket.py?r1=77263&r2=77262&pathrev=77263
msg129717 - (view) Author: Giampaolo Rodola' (giampaolo.rodola) * (Python committer) Date: 2011-02-28 19:20
Committed in r88679.
msg130188 - (view) Author: Nadeem Vawda (nadeem.vawda) * (Python committer) Date: 2011-03-06 20:17
test_source_address_passive_connection() raises a ResourceWarning. Fix attached.
msg130191 - (view) Author: Giampaolo Rodola' (giampaolo.rodola) * (Python committer) Date: 2011-03-06 21:05
Thanks. Committed in r88761.
msg130192 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2011-03-06 21:11
Giampaolo, can you make your commit on the Mercurial repo instead?

See http://mail.python.org/pipermail/python-dev/2011-March/108738.html
msg130238 - (view) Author: Giampaolo Rodola' (giampaolo.rodola) * (Python committer) Date: 2011-03-07 08:14
Committed in r68309.
msg130239 - (view) Author: Giampaolo Rodola' (giampaolo.rodola) * (Python committer) Date: 2011-03-07 08:15
Ok, that wasn't r68309. =)
I'm not sure what revision number is now that we're using mercurial.
msg130242 - (view) Author: Nadeem Vawda (nadeem.vawda) * (Python committer) Date: 2011-03-07 08:56
I'm not seeing the commit anywhere. Did you perhaps forget to "hg push" after committing?
msg130370 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2011-03-08 20:33
New changeset 7f605fa1688d by Giampaolo Rodol�� in branch 'default':
#8594: fix ResourceWarning in test_ftplib.py - patch by Nadeem Vawda.
http://hg.python.org/cpython/rev/7f605fa1688d
History
Date User Action Args
2022-04-11 14:57:00adminsetgithub: 52840
2011-03-08 20:38:34giampaolo.rodolasetstatus: open -> closed
nosy: pitrou, giampaolo.rodola, nadeem.vawda, r.david.murray, python-dev
2011-03-08 20:33:33python-devsetnosy: + python-dev
messages: + msg130370
2011-03-07 08:56:31nadeem.vawdasetnosy: pitrou, giampaolo.rodola, nadeem.vawda, r.david.murray
messages: + msg130242
2011-03-07 08:15:47giampaolo.rodolasetnosy: pitrou, giampaolo.rodola, nadeem.vawda, r.david.murray
messages: + msg130239
2011-03-07 08:14:50giampaolo.rodolasetstatus: pending -> open
nosy: pitrou, giampaolo.rodola, nadeem.vawda, r.david.murray
messages: + msg130238
2011-03-06 21:11:56pitrousetstatus: closed -> pending
nosy: pitrou, giampaolo.rodola, nadeem.vawda, r.david.murray
messages: + msg130192
2011-03-06 21:05:05giampaolo.rodolasetstatus: pending -> closed
nosy: pitrou, giampaolo.rodola, nadeem.vawda, r.david.murray
messages: + msg130191
2011-03-06 20:23:56pitrousetstatus: closed -> pending
nosy: pitrou, giampaolo.rodola, nadeem.vawda, r.david.murray
2011-03-06 20:17:13nadeem.vawdasetfiles: + test_ftplib-leak.diff
nosy: + nadeem.vawda
messages: + msg130188

2011-02-28 19:30:14giampaolo.rodolasetstatus: open -> closed
nosy: pitrou, giampaolo.rodola, r.david.murray
resolution: fixed
2011-02-28 19:20:21giampaolo.rodolasetnosy: pitrou, giampaolo.rodola, r.david.murray
messages: + msg129717
versions: + Python 3.3, - Python 3.2
2011-02-26 18:26:55giampaolo.rodolasetfiles: + ftplib_source_address.patch
nosy: pitrou, giampaolo.rodola, r.david.murray
messages: + msg129582
2010-09-04 00:09:11pitrousetassignee: giampaolo.rodola
2010-05-02 21:36:15giampaolo.rodolasetmessages: + msg104805
2010-05-01 22:01:55pitrousetmessages: + msg104753
2010-05-01 20:39:48giampaolo.rodolalinkissue1661754 superseder
2010-05-01 20:33:01giampaolo.rodolacreate