Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/ui.py @ 29774:96bd27eb23f0
ui: drop values returned by inspect.*frame*() to avoid cycles
"f = inspect.currentframe()" instantly creates a cycle because
"f.f_locals['f']" is "f" itself.
This patch explicitly sets those frame objects to None to avoid cycles.
author | Jun Wu <quark@fb.com> |
---|---|
date | Wed, 10 Aug 2016 15:05:20 +0100 |
parents | 31d3ab7985b8 |
children | 3d2ea1403c62 |
comparison
equal
deleted
inserted
replaced
29773:39149b6036e6 | 29774:96bd27eb23f0 |
---|---|
1173 calframe = inspect.getouterframes(curframe, 2) | 1173 calframe = inspect.getouterframes(curframe, 2) |
1174 self.write_err('%s at: %s:%s (%s)\n' | 1174 self.write_err('%s at: %s:%s (%s)\n' |
1175 % ((msg,) + calframe[stacklevel][1:4])) | 1175 % ((msg,) + calframe[stacklevel][1:4])) |
1176 self.log('develwarn', '%s at: %s:%s (%s)\n', | 1176 self.log('develwarn', '%s at: %s:%s (%s)\n', |
1177 msg, *calframe[stacklevel][1:4]) | 1177 msg, *calframe[stacklevel][1:4]) |
1178 curframe = calframe = None # avoid cycles | |
1178 | 1179 |
1179 def deprecwarn(self, msg, version): | 1180 def deprecwarn(self, msg, version): |
1180 """issue a deprecation warning | 1181 """issue a deprecation warning |
1181 | 1182 |
1182 - msg: message explaining what is deprecated and how to upgrade, | 1183 - msg: message explaining what is deprecated and how to upgrade, |