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

Turn SFTPFile into a context manager #127

Merged
merged 3 commits into from Feb 27, 2013

Conversation

mwilliamson
Copy link
Contributor

Allow instances of SFTPFile to be used in with statements by turning it into a context manager.

@mwilliamson
Copy link
Contributor Author

Hmm, but as the build failure points out, just checking for Python version in the tests isn't sufficient since it's a syntax in 2.5 without:

from __future__ import with_statement

And presumably it'll just always fail in Python 2.4. Should it be possible to run the tests successfully on Python 2.4? The actual code should still work fine since it's just adding two methods that'll never get called.

@mwilliamson
Copy link
Contributor Author

If the tests need to pass on Python 2.4, then one possibility is to have a separate module for testing this feature, and conditionally import that module in test.py.

@bitprophet
Copy link
Member

At this point I'm not supporting Paramiko on anything older than 2.5, so no worries about that.

Thanks for the submission, will take a look soon hopefully. Also, noting for linkage that this is related to #38.

@bitprophet
Copy link
Member

LGTM. Thanks again!

bitprophet added a commit that referenced this pull request Feb 27, 2013
@bitprophet bitprophet merged commit a69abd4 into paramiko:master Feb 27, 2013
bitprophet added a commit that referenced this pull request Feb 27, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants