[issue23224] LZMADecompressor object is only initialized in __init__

2018-06-21 Thread STINNER Victor


STINNER Victor  added the comment:

Calling directly __new__() is very unusual, so I'm not surprised that you found 
bugs. Calling __init__() twice is also an unusal practice. I concur with 
Serhiy: implementing new instead of init should prevent such bug. I recall that 
some objects decided instead to raise an exception if they are not fully 
initialized (if init has not been called), but using new instead of init seems 
to be safer approach if we can implement it.

In the meanwhile, I blocked by the memory leak (handle leak) in bz2 and lzma: 
bpo-33916. I proposed a very simple fix: PR 7843. I propose to apply this one 
since it's easy to backport it to all branches, whereas replacing init with new 
would be more difficult and risky to backport: I would suggest to only make 
this change in the master.

What do you think?

--
nosy: +vstinner

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue23224] LZMADecompressor object is only initialized in __init__

2018-06-20 Thread Zackery Spytz


Change by Zackery Spytz :


--
nosy: +ZackerySpytz
versions: +Python 3.8

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue23224] LZMADecompressor object is only initialized in __init__

2018-06-20 Thread Zackery Spytz


Change by Zackery Spytz :


--
pull_requests: +7430
stage: needs patch -> patch review

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue23224] LZMADecompressor object is only initialized in __init__

2017-10-23 Thread Serhiy Storchaka

Change by Serhiy Storchaka :


--
nosy: +Oren Milman
versions:  -Python 3.5

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue23224] LZMADecompressor object is only initialized in __init__

2016-12-02 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

This is not the only issue. Calling __init__ multiple times causes leaking 
locks, bz2/lzma internal buffers, etc.

It looks to me that the most straightforward way is using __new__ instead of 
__init__.

--
versions: +Python 3.6, Python 3.7 -Python 3.4

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue23224] LZMADecompressor object is only initialized in __init__

2016-12-01 Thread Aaron Hill

Aaron Hill added the comment:

I've upload a patch which should address the issue in both the lzma and bz2 
modules.

--
keywords: +patch
nosy: +Aaron1011
Added file: http://bugs.python.org/file45730/fix-lzma-bz2-segfaults.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue23224] LZMADecompressor object is only initialized in __init__

2015-02-21 Thread Martin Panter

Martin Panter added the comment:

Similar situation in the bzip module:

 BZ2Decompressor.__new__(BZ2Decompressor).decompress(bytes())
Segmentation fault (core dumped)

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue23224
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue23224] LZMADecompressor object is only initialized in __init__

2015-01-12 Thread Martin Panter

Martin Panter added the comment:

A patch for this might conflict with the LZMA patch for Issue 15955, so it 
would be simplest to wait for that issue to be resolved first

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue23224
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue23224] LZMADecompressor object is only initialized in __init__

2015-01-11 Thread Martin Panter

New submission from Martin Panter:

Noticed in a patch review around LZMModules/_lzmamodule.c:1055 that the C-level 
LZMADecompressor object is being initialized in an __init__() method. It 
crashes if you create the object with __new__() and never call __init__():

 from lzma import LZMADecompressor
 LZMADecompressor.__new__(LZMADecompressor).decompress(bytes())
Segmentation fault (core dumped)
[Exit 139]

--
components: Extension Modules
messages: 233866
nosy: vadmium
priority: normal
severity: normal
status: open
title: LZMADecompressor object is only initialized in __init__
type: crash
versions: Python 3.4

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue23224
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue23224] LZMADecompressor object is only initialized in __init__

2015-01-11 Thread Serhiy Storchaka

Changes by Serhiy Storchaka storch...@gmail.com:


--
nosy: +nadeem.vawda, serhiy.storchaka
stage:  - needs patch
versions: +Python 3.5

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue23224
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com