[issue9928] weird oddity with bz2 context manager

2015-09-23 Thread Roman Valls
Roman Valls added the comment: Gotcha, sorry about that :-S On Wed, Sep 23, 2015 at 4:43 PM, Armin Rigo wrote: > > Armin Rigo added the comment: > > Roman: bz2.decompress(comp.read()) returns a string, so you can't use "with" > on it. This bug was about using "with bz2.BZ2File(...) as f:". >

[issue9928] weird oddity with bz2 context manager

2015-09-23 Thread Armin Rigo
Armin Rigo added the comment: Roman: bz2.decompress(comp.read()) returns a string, so you can't use "with" on it. This bug was about using "with bz2.BZ2File(...) as f:". -- ___ Python tracker _

[issue9928] weird oddity with bz2 context manager

2015-09-23 Thread Roman Valls
Roman Valls added the comment: It still seems to be failing with Python 2.7.10... or am I doing sth wrong? :/ $ ipython Python 2.7.10 |Anaconda 2.2.0 (x86_64)| (default, May 28 2015, 17:04:42) Type "copyright", "credits" or "license" for more information. IPython 4.0.0 -- An enhanced Interacti

[issue9928] weird oddity with bz2 context manager

2010-09-23 Thread Antoine Pitrou
Antoine Pitrou added the comment: Patch committed in r84980 (3.2), r84981 (3.1) and r84982 (2.7). -- resolution: -> fixed status: open -> closed ___ Python tracker ___ _

[issue9928] weird oddity with bz2 context manager

2010-09-23 Thread Benjamin Peterson
Benjamin Peterson added the comment: 2010/9/23 Antoine Pitrou : > > Antoine Pitrou added the comment: > > Actually, it is because bz2 doesn't call PyType_Ready() but instead sets some > field manually. Perhaps we could have a guard somewhere that raises a fatal > error when a C extension type

[issue9928] weird oddity with bz2 context manager

2010-09-23 Thread Antoine Pitrou
Antoine Pitrou added the comment: Actually, it is because bz2 doesn't call PyType_Ready() but instead sets some field manually. Perhaps we could have a guard somewhere that raises a fatal error when a C extension type hasn't been properly readied? In the meantime, this patch seems to solve th

[issue9928] weird oddity with bz2 context manager

2010-09-23 Thread Antoine Pitrou
New submission from Antoine Pitrou : I haven't investigated but this is weird (especially the fact that it doesn't *always* happen). There might be a problem with SETUP_WITH or perhaps the method cache: >>> import bz2 >>> f = bz2.BZ2File('foo.bz2', 'wb') >>> with f: pass ... Traceback (most r