[issue26612] test_ssl: use context manager (with) to fix ResourceWarning

2017-09-06 Thread STINNER Victor
STINNER Victor added the comment: Sorry, I lost track of this issue. ResourceWarning only occurs on a bug, so it don't think that the issue is really important. I just close it. -- resolution: -> out of date stage: patch review -> resolved status: open -> closed

[issue26612] test_ssl: use context manager (with) to fix ResourceWarning

2017-09-06 Thread Christian Heimes
Christian Heimes added the comment: Victor, are you still interested to fix this issue? -- assignee: christian.heimes -> haypo versions: +Python 3.7 ___ Python tracker

[issue26612] test_ssl: use context manager (with) to fix ResourceWarning

2016-09-15 Thread Christian Heimes
Changes by Christian Heimes : -- assignee: -> christian.heimes components: +SSL nosy: +christian.heimes ___ Python tracker ___

[issue26612] test_ssl: use context manager (with) to fix ResourceWarning

2016-03-25 Thread Martin Panter
Martin Panter added the comment: In many cases I prefer “with” over “try / finally”. But Python 2’s sockets do not support “with” statements, so choice (2) is not possible for 2.7. I found one potential technical problem, and maybe some redundant close() calls in the review. --

[issue26612] test_ssl: use context manager (with) to fix ResourceWarning

2016-03-25 Thread STINNER Victor
STINNER Victor added the comment: "try: ... finally: s.close()" are "with s: ..." do the same thing, but I prefer "with" (context-manager). IMO it's more "pythonic". I prefer to see the "cleanup block" at the beginning, rather than at the end. > My point about Python 2 was that this might add

[issue26612] test_ssl: use context manager (with) to fix ResourceWarning

2016-03-23 Thread Martin Panter
Martin Panter added the comment: My point about Python 2 was that this might add an annoying difference between the two branches. Even if you don’t apply this to Py 2, the next person adding or updating a test might be inclined to do it. Looking closer at your patch I admit that addCleanup()

[issue26612] test_ssl: use context manager (with) to fix ResourceWarning

2016-03-23 Thread STINNER Victor
STINNER Victor added the comment: Martin Panter added the comment: > Wouldn’t it be better to fix the underlying problem with the test cases? I don't feel able to fix AIX issues, and I don't think that we can fix all issues. You still get ResourceWarning if you interrupt the test with CTRL+c

[issue26612] test_ssl: use context manager (with) to fix ResourceWarning

2016-03-22 Thread Martin Panter
Martin Panter added the comment: Also remember that sockets don’t do context management in Python 2, so this would bring more incompatibilies when merging tests between the two branches. -- ___ Python tracker

[issue26612] test_ssl: use context manager (with) to fix ResourceWarning

2016-03-22 Thread Martin Panter
Martin Panter added the comment: Wouldn’t it be better to fix the underlying problem with the test cases? As I understand it, that would also avoid the warnings :) Also, you can often use self.addCleanup(s.close), which saves a level of indentation (and associated noise in the annotate

[issue26612] test_ssl: use context manager (with) to fix ResourceWarning

2016-03-22 Thread STINNER Victor
New submission from STINNER Victor: Attached patch modifies Lib/test/test_ssl.py to use "with socket:" instead of "try: ... finally: socket.close()" or similar patterns. Our PPC64 AIX 3.x buildbot has a broken ssl module. A lot of tests logs ResourceWarning on unclosed sockets, because errors