pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/devel/py-mercurial Fix a memory leak, from upstream. B...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/34f380eb08c4
branches:  trunk
changeset: 365777:34f380eb08c4
user:      joerg <joerg%pkgsrc.org@localhost>
date:      Tue Jul 25 16:09:40 2017 +0000

description:
Fix a memory leak, from upstream. Bump revision.

diffstat:

 devel/py-mercurial/Makefile                                  |   3 +-
 devel/py-mercurial/distinfo                                  |   4 +-
 devel/py-mercurial/patches/patch-mercurial_localrepo.py      |  43 ++++++++++++
 devel/py-mercurial/patches/patch-mercurial_statichttprepo.py |  15 ++++
 4 files changed, 63 insertions(+), 2 deletions(-)

diffs (92 lines):

diff -r 09bafbb9cb50 -r 34f380eb08c4 devel/py-mercurial/Makefile
--- a/devel/py-mercurial/Makefile       Tue Jul 25 14:30:42 2017 +0000
+++ b/devel/py-mercurial/Makefile       Tue Jul 25 16:09:40 2017 +0000
@@ -1,7 +1,8 @@
-# $NetBSD: Makefile,v 1.12 2017/05/17 10:30:18 wiz Exp $
+# $NetBSD: Makefile,v 1.13 2017/07/25 16:09:40 joerg Exp $
 
 DISTNAME=      mercurial-${VERSION}
 PKGNAME=       ${PYPKGPREFIX}-${DISTNAME}
+PKGREVISION=   1
 CATEGORIES=    devel scm
 MASTER_SITES=  https://www.mercurial-scm.org/release/
 
diff -r 09bafbb9cb50 -r 34f380eb08c4 devel/py-mercurial/distinfo
--- a/devel/py-mercurial/distinfo       Tue Jul 25 14:30:42 2017 +0000
+++ b/devel/py-mercurial/distinfo       Tue Jul 25 16:09:40 2017 +0000
@@ -1,6 +1,8 @@
-$NetBSD: distinfo,v 1.50 2017/06/19 20:07:43 wiz Exp $
+$NetBSD: distinfo,v 1.51 2017/07/25 16:09:40 joerg Exp $
 
 SHA1 (mercurial-4.2.1.tar.gz) = 3fb8e228c8e3129cae1b222085984f4f90c7140b
 RMD160 (mercurial-4.2.1.tar.gz) = a0dead4f0307fd168aa3a33aa9fd5971340eedc3
 SHA512 (mercurial-4.2.1.tar.gz) = 0349fb5343210869bacb2247d30546676e5cf486f64fb8ebb2b1c6cdf7d564e7b754a43fb5b61c7d7e66a67609c514c8e15f415f4189bccbebb2fbb5a5474645
 Size (mercurial-4.2.1.tar.gz) = 5317692 bytes
+SHA1 (patch-mercurial_localrepo.py) = 2db659d4d5ee12c26a5dc78c87d5c30857cc3fb8
+SHA1 (patch-mercurial_statichttprepo.py) = a16b8eeae241cf0ecff310b6af70559b7a45daa2
diff -r 09bafbb9cb50 -r 34f380eb08c4 devel/py-mercurial/patches/patch-mercurial_localrepo.py
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/devel/py-mercurial/patches/patch-mercurial_localrepo.py   Tue Jul 25 16:09:40 2017 +0000
@@ -0,0 +1,43 @@
+$NetBSD: patch-mercurial_localrepo.py,v 1.1 2017/07/25 16:09:40 joerg Exp $
+
+https://www.mercurial-scm.org/repo/hg/rev/7e89b
+
+--- mercurial/localrepo.py.orig        2017-06-04 13:16:29.000000000 +0000
++++ mercurial/localrepo.py
+@@ -382,6 +382,9 @@ class localrepository(object):
+         # - bookmark changes
+         self.filteredrevcache = {}
+ 
++        # Cache of types representing filtered repos.
++        self._filteredrepotypes = weakref.WeakKeyDictionary()
++
+         # generic mapping between names and nodes
+         self.names = namespaces.namespaces()
+ 
+@@ -489,11 +492,21 @@ class localrepository(object):
+ 
+     def filtered(self, name):
+         """Return a filtered version of a repository"""
+-        # build a new class with the mixin and the current class
+-        # (possibly subclass of the repo)
+-        class filteredrepo(repoview.repoview, self.unfiltered().__class__):
+-            pass
+-        return filteredrepo(self, name)
++        # Python <3.4 easily leaks types via __mro__. See
++        # https://bugs.python.org/issue17950. We cache dynamically
++        # created types so this method doesn't leak on every
++        # invocation.
++
++        key = self.unfiltered().__class__
++        if key not in self._filteredrepotypes:
++            # Build a new type with the repoview mixin and the base
++            # class of this repo. Give it a name containing the
++            # filter name to aid debugging.
++            bases = (repoview.repoview, key)
++            cls = type('%sfilteredrepo' % name, bases, {})
++            self._filteredrepotypes[key] = cls
++
++        return self._filteredrepotypes[key](self, name)
+ 
+     @repofilecache('bookmarks', 'bookmarks.current')
+     def _bookmarks(self):
diff -r 09bafbb9cb50 -r 34f380eb08c4 devel/py-mercurial/patches/patch-mercurial_statichttprepo.py
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/devel/py-mercurial/patches/patch-mercurial_statichttprepo.py      Tue Jul 25 16:09:40 2017 +0000
@@ -0,0 +1,15 @@
+$NetBSD: patch-mercurial_statichttprepo.py,v 1.1 2017/07/25 16:09:40 joerg Exp $
+
+https://www.mercurial-scm.org/repo/hg/rev/7e89b
+
+--- mercurial/statichttprepo.py.orig   2017-06-04 13:16:29.000000000 +0000
++++ mercurial/statichttprepo.py
+@@ -164,6 +164,8 @@ class statichttprepository(localrepo.loc
+         self.encodepats = None
+         self.decodepats = None
+         self._transref = None
++        # Cache of types representing filtered repos.
++        self._filteredrepotypes = {}
+ 
+     def _restrictcapabilities(self, caps):
+         caps = super(statichttprepository, self)._restrictcapabilities(caps)



Home | Main Index | Thread Index | Old Index