STINNER Victor added the comment:

I can reproduce the issue with Python 2.7. The problem is that 
BZ2File.__init__() doesn't reset the object when __init__() is called twice.

For example, the following script fails with "too many open files" error, 
before the previous file is not called:
---
import bz2
obj = bz2.BZ2File('bla.bz2')
for loop in range(1024*10):
    obj.__init__('bla.bz2')
---

By the way, why do you call __init__() twice? Why not creating a new object?

BZ2File was rewritten in pure Python in Python 3.3. Python 3.3+ is not affected 
by this issue.

----------
nosy: +haypo, serhiy.storchaka
resolution: rejected -> 
stage: committed/rejected -> 
status: closed -> open
title: PyFile_DecUseCount() SIGSEGV -> bz2.BZ2File.__init__() cannot be called 
twice
versions: +Python 2.7 -Python 2.6

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue19878>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to