[issue19972] Leak in pickle (?)

2013-12-14 Thread Stefan Krah
Stefan Krah added the comment: Should be fixed. Thanks for the comments everyone. -- resolution: -> fixed stage: patch review -> committed/rejected status: open -> closed ___ Python tracker ___

[issue19972] Leak in pickle (?)

2013-12-14 Thread Roundup Robot
Roundup Robot added the comment: New changeset 8a78988fdb04 by Stefan Krah in branch 'default': Issue #19972: Add rarely used freefunc. This fixes a leak if sys.exit() http://hg.python.org/cpython/rev/8a78988fdb04 -- nosy: +python-dev ___ Python trac

[issue19972] Leak in pickle (?)

2013-12-13 Thread Stefan Krah
Stefan Krah added the comment: I just see that it should be: static void pickle_free(PyObject *m) ... Even then, the cast is necessary, otherwise you get this warning: /home/stefan/hg/cpython/Modules/_pickle.c:7450:1: warning: initialization from incompatible pointer type [enabled by default

[issue19972] Leak in pickle (?)

2013-12-13 Thread Alexandre Vassalotti
Alexandre Vassalotti added the comment: The patch is good. I am not sure if you need the freefunc cast though. The example in the PEP 3121 should updated if freefunc is actually required. I didn't define freefunc because of this example. -- ___ Pyth

[issue19972] Leak in pickle (?)

2013-12-13 Thread Antoine Pitrou
Antoine Pitrou added the comment: Yeah, it sounds logical for m_free to do the clearing too (same as tp_dealloc vs. tp_clear). Note that the PEP 3121 scheme turns out to be problematic for proper resource management: https://mail.python.org/pipermail/python-dev/2013-August/127862.html ---

[issue19972] Leak in pickle (?)

2013-12-13 Thread Stefan Krah
Stefan Krah added the comment: The docs say: inquiry m_clear A clear function to call during GC clearing of the module object, or NULL if not needed. freefunc m_free A function to call during deallocation of the module object, or NULL if not needed. So I assume that GC clearing is

[issue19972] Leak in pickle (?)

2013-12-13 Thread Stefan Krah
Stefan Krah added the comment: See #11826 for more details where the freefunc is called. Perhaps the. docs or the PEP need an update. -- ___ Python tracker ___ _

[issue19972] Leak in pickle (?)

2013-12-13 Thread STINNER Victor
STINNER Victor added the comment: According to the example in the PEP 3121, issue19972.patch is not needed. In practice, I don't see in PyImport_Cleanup() where tp_clear is called. This function calls: _PyModule_Clear(mod); Py_DECREF(mod); -- nosy: +haypo __

[issue19972] Leak in pickle (?)

2013-12-13 Thread Stefan Krah
Changes by Stefan Krah : -- stage: -> patch review ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mai

[issue19972] Leak in pickle (?)

2013-12-13 Thread Stefan Krah
Stefan Krah added the comment: This patch fixes the leak, but needs review (I do not know the _pickle module very well). -- keywords: +patch Added file: http://bugs.python.org/file33119/issue19972.patch ___ Python tracker

[issue19972] Leak in pickle (?)

2013-12-13 Thread Stefan Krah
New submission from Stefan Krah: Hi Alexandre, the following leaks appear after 64c6d52793be. I'm not sure yet if they're caused or just exposed by the changeset. Code: == import sys import pickle sys.exit(0) == ==8118== 864 (192 direct, 672 indirect) bytes in 3 blocks