Mercurial > hg-stable
changeset 30810:df5d3734b3df
check-code: reject module-level @cachefunc
Module-level @cachefunc usage is risky because it can easily create a
memory "leak". Let's reject it completely for now. If a valid usage
comes up in the future, we can always improve the check or reconsider.
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Fri, 13 Jan 2017 10:11:37 -0800 |
parents | 8614546154cb |
children | cf1e15f91c90 |
files | contrib/check-code.py |
diffstat | 1 files changed, 1 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/contrib/check-code.py Fri Jan 13 11:42:36 2017 -0800 +++ b/contrib/check-code.py Fri Jan 13 10:11:37 2017 -0800 @@ -325,6 +325,7 @@ # XXX only catch mutable arguments on the first line of the definition (r'def.*[( ]\w+=\{\}', "don't use mutable default arguments"), (r'\butil\.Abort\b', "directly use error.Abort"), + (r'^@(\w*\.)?cachefunc', "module-level @cachefunc is risky, please avoid"), (r'^import Queue', "don't use Queue, use util.queue + util.empty"), (r'^import cStringIO', "don't use cStringIO.StringIO, use util.stringio"), (r'^import urllib', "don't use urllib, use util.urlreq/util.urlerr"),