[issue7461] os.popen() objects don't support the context manager protocol

2009-12-08 Thread Antoine Pitrou
New submission from Antoine Pitrou pit...@free.fr: This works under trunk but fails under py3k: import os with os.popen(ls, r) as f: ... print(f.read()) ... Traceback (most recent call last): File stdin, line 1, in module AttributeError: __exit__ -- components: Library (Lib)

[issue7461] os.popen() objects don't support the context manager protocol

2009-12-08 Thread Amaury Forgeot d'Arc
Amaury Forgeot d'Arc amaur...@gmail.com added the comment: Here is a patch+test -- keywords: +patch nosy: +amaury.forgeotdarc Added file: http://bugs.python.org/file15504/with_popen.patch ___ Python tracker rep...@bugs.python.org

[issue7461] os.popen() objects don't support the context manager protocol

2009-12-08 Thread Antoine Pitrou
Antoine Pitrou pit...@free.fr added the comment: We should also proxy other special methods. There is __iter__, __next__, what else? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue7461 ___

[issue7461] os.popen() objects don't support the context manager protocol

2009-12-08 Thread Antoine Pitrou
Antoine Pitrou pit...@free.fr added the comment: Ah, iterating already works. Sorry for the noise. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue7461 ___

[issue7461] os.popen() objects don't support the context manager protocol

2009-12-08 Thread Antoine Pitrou
Antoine Pitrou pit...@free.fr added the comment: I added a test for iterating and committed the patch in r76723 and r76724. Thanks! -- resolution: - fixed status: open - closed ___ Python tracker rep...@bugs.python.org