[issue31723] refleaks in zipimport when calling zipimporter.__init__() more than once

2017-10-09 Thread Oren Milman

Oren Milman  added the comment:

Yes, i am going manually over the code to find similar stuff to #31718,
and i afraid i found quite a few, and still working on it..

--

___
Python tracker 

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



[issue31723] refleaks in zipimport when calling zipimporter.__init__() more than once

2017-10-09 Thread STINNER Victor

STINNER Victor  added the comment:

> I'm curious, how did you find this code? Are you using a code generator 
> coupled with a tool to track for reference leaks?

Oh, I think that the issue is related to bpo-31718.

--

___
Python tracker 

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



[issue31723] refleaks in zipimport when calling zipimporter.__init__() more than once

2017-10-09 Thread STINNER Victor

STINNER Victor  added the comment:

I merged your PR, thanks! As I wrote on the PR:

I don't think that a NEWS entry is needed, since you are not supposed to call 
__init__() multiple times.

I don't think that it's worth it to backport the fix to Python 2.7 and 3.6. So 
I close the issue.

--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

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



[issue31723] refleaks in zipimport when calling zipimporter.__init__() more than once

2017-10-09 Thread STINNER Victor

STINNER Victor  added the comment:

> The following code causes refleaks:

I'm curious, how did you find this code? Are you using a code generator coupled 
with a tool to track for reference leaks?

--

___
Python tracker 

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



[issue31723] refleaks in zipimport when calling zipimporter.__init__() more than once

2017-10-09 Thread STINNER Victor

STINNER Victor  added the comment:


New changeset c0cabc23bbe474d542ff8a4f1243f4ec3cce5549 by Victor Stinner (Oren 
Milman) in branch 'master':
bpo-31723: Fix refleaks when zipimporter.__init__() is called more than once 
(GH-3919)
https://github.com/python/cpython/commit/c0cabc23bbe474d542ff8a4f1243f4ec3cce5549


--
nosy: +haypo

___
Python tracker 

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



[issue31723] refleaks in zipimport when calling zipimporter.__init__() more than once

2017-10-07 Thread Oren Milman

Change by Oren Milman :


--
keywords: +patch
pull_requests: +3892
stage:  -> patch review

___
Python tracker 

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



[issue31723] refleaks in zipimport when calling zipimporter.__init__() more than once

2017-10-07 Thread Oren Milman

New submission from Oren Milman :

The following code causes refleaks:
import zipimport
zi = zipimport.zipimporter.__new__(zipimport.zipimporter)
zi.__init__('bar.zip')
zi.__init__('bar.zip')
zi.__init__('bar.zip\\foo')

This is because zipimport_zipimporter___init___impl() (in Modules/zipimport.c)
doesn't decref (if needed) before assigning to `self->files`, `self->archive`
and `self->prefix`.

I would open a PR to fix this soon.

Should i add a test to test_zipimport?
If yes, could you point out some similar refcount test to help me write this
test?

--
components: Extension Modules
messages: 303883
nosy: Oren Milman
priority: normal
severity: normal
status: open
title: refleaks in zipimport when calling zipimporter.__init__() more than once
type: resource usage
versions: Python 3.7

___
Python tracker 

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