Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a "source_address" option to ftplib #52840

Closed
giampaolo opened this issue May 1, 2010 · 12 comments
Closed

Add a "source_address" option to ftplib #52840

giampaolo opened this issue May 1, 2010 · 12 comments
Assignees
Labels
stdlib Python modules in the Lib dir type-feature A feature request or enhancement

Comments

@giampaolo
Copy link
Contributor

BPO 8594
Nosy @pitrou, @giampaolo, @bitdancer
Files
  • ftplib_source_address.patch
  • ftplib_source_address.patch
  • test_ftplib-leak.diff
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = 'https://github.com/giampaolo'
    closed_at = <Date 2011-03-08.20:38:34.675>
    created_at = <Date 2010-05-01.20:33:01.109>
    labels = ['type-feature', 'library']
    title = 'Add a "source_address" option to ftplib'
    updated_at = <Date 2011-03-08.20:38:34.674>
    user = 'https://github.com/giampaolo'

    bugs.python.org fields:

    activity = <Date 2011-03-08.20:38:34.674>
    actor = 'giampaolo.rodola'
    assignee = 'giampaolo.rodola'
    closed = True
    closed_date = <Date 2011-03-08.20:38:34.675>
    closer = 'giampaolo.rodola'
    components = ['Library (Lib)']
    creation = <Date 2010-05-01.20:33:01.109>
    creator = 'giampaolo.rodola'
    dependencies = []
    files = ['17172', '20920', '21019']
    hgrepos = []
    issue_num = 8594
    keywords = ['patch', 'needs review']
    message_count = 12.0
    messages = ['104749', '104753', '104805', '129582', '129717', '130188', '130191', '130192', '130238', '130239', '130242', '130370']
    nosy_count = 5.0
    nosy_names = ['pitrou', 'giampaolo.rodola', 'nadeem.vawda', 'r.david.murray', 'python-dev']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = None
    status = 'closed'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue8594'
    versions = ['Python 3.3']

    @giampaolo
    Copy link
    Contributor Author

    Similarly to bpo-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 bpo-1661754.

    @giampaolo giampaolo added stdlib Python modules in the Lib dir type-feature A feature request or enhancement labels May 1, 2010
    @pitrou
    Copy link
    Member

    pitrou commented May 1, 2010

    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.

    @giampaolo
    Copy link
    Contributor Author

    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.

    @giampaolo
    Copy link
    Contributor Author

    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

    @giampaolo
    Copy link
    Contributor Author

    Committed in r88679.

    @nadeemvawda
    Copy link
    Mannequin

    nadeemvawda mannequin commented Mar 6, 2011

    test_source_address_passive_connection() raises a ResourceWarning. Fix attached.

    @pitrou pitrou reopened this Mar 6, 2011
    @giampaolo
    Copy link
    Contributor Author

    Thanks. Committed in r88761.

    @pitrou
    Copy link
    Member

    pitrou commented Mar 6, 2011

    Giampaolo, can you make your commit on the Mercurial repo instead?

    See http://mail.python.org/pipermail/python-dev/2011-March/108738.html

    @pitrou pitrou reopened this Mar 6, 2011
    @giampaolo
    Copy link
    Contributor Author

    Committed in r68309.

    @giampaolo
    Copy link
    Contributor Author

    Ok, that wasn't r68309. =)
    I'm not sure what revision number is now that we're using mercurial.

    @nadeemvawda
    Copy link
    Mannequin

    nadeemvawda mannequin commented Mar 7, 2011

    I'm not seeing the commit anywhere. Did you perhaps forget to "hg push" after committing?

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Mar 8, 2011

    New changeset 7f605fa1688d by Giampaolo Rodol�� in branch 'default':
    bpo-8594: fix ResourceWarning in test_ftplib.py - patch by Nadeem Vawda.
    http://hg.python.org/cpython/rev/7f605fa1688d

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    stdlib Python modules in the Lib dir type-feature A feature request or enhancement
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants