Submitter | Jun Wu |
---|---|
Date | Aug. 10, 2016, 2:08 p.m. |
Message ID | <1d492a4de1135415a890.1470838096@x1c> |
Download | mbox | patch |
Permalink | /patch/16235/ |
State | Accepted |
Headers | show |
Comments
Excerpts from Jun Wu's message of 2016-08-10 15:08:16 +0100: > # HG changeset patch > # User Jun Wu <quark@fb.com> > # Date 1470837920 -3600 > # Wed Aug 10 15:05:20 2016 +0100 > # Node ID 1d492a4de1135415a890cd46c8622e4f339a9db8 > # Parent 3df9f780c90ec179a2f87802f352a0273da9a364 > # Available At https://bitbucket.org/quark-zju/hg-draft > # hg pull https://bitbucket.org/quark-zju/hg-draft -r 1d492a4de113 > ui: drop values returned by inspect.*frame*() to avoid cycles > > "f = inspect.currentframe()" instantly creates a cycle because > "f.f_locals['a']" is "f" itself. This "a" should be changed to "f". Hope someone can fix it in flight. Sorry for the inconvenience. > > This patch explicitly sets those frame objects to None to avoid cycles. > > diff --git a/mercurial/ui.py b/mercurial/ui.py > --- a/mercurial/ui.py > +++ b/mercurial/ui.py > @@ -1175,6 +1175,7 @@ class ui(object): > % ((msg,) + calframe[stacklevel][1:4])) > self.log('develwarn', '%s at: %s:%s (%s)\n', > msg, *calframe[stacklevel][1:4]) > + curframe = calframe = None > > def deprecwarn(self, msg, version): > """issue a deprecation warning
On Wed, 10 Aug 2016 15:08:16 +0100, Jun Wu wrote: > # HG changeset patch > # User Jun Wu <quark@fb.com> > # Date 1470837920 -3600 > # Wed Aug 10 15:05:20 2016 +0100 > # Node ID 1d492a4de1135415a890cd46c8622e4f339a9db8 > # Parent 3df9f780c90ec179a2f87802f352a0273da9a364 > # Available At https://bitbucket.org/quark-zju/hg-draft > # hg pull https://bitbucket.org/quark-zju/hg-draft -r 1d492a4de113 > ui: drop values returned by inspect.*frame*() to avoid cycles Queued, thanks. > diff --git a/mercurial/ui.py b/mercurial/ui.py > --- a/mercurial/ui.py > +++ b/mercurial/ui.py > @@ -1175,6 +1175,7 @@ class ui(object): > % ((msg,) + calframe[stacklevel][1:4])) > self.log('develwarn', '%s at: %s:%s (%s)\n', > msg, *calframe[stacklevel][1:4]) > + curframe = calframe = None Added "# avoid cycles" to make it less obscure.
Patch
diff --git a/mercurial/ui.py b/mercurial/ui.py --- a/mercurial/ui.py +++ b/mercurial/ui.py @@ -1175,6 +1175,7 @@ class ui(object): % ((msg,) + calframe[stacklevel][1:4])) self.log('develwarn', '%s at: %s:%s (%s)\n', msg, *calframe[stacklevel][1:4]) + curframe = calframe = None def deprecwarn(self, msg, version): """issue a deprecation warning