# HG changeset patch # User Gregory Szorc # Date 1489380872 25200 # Node ID 8b6927eb7efdca0db4e74e5eecb55408c1b3a1b6 # Parent 6168d4b93634a518a487d96ec64d0efb63b20ac0 util: don't use mutable default argument value I don't think this is any tight loops and we'd need to worry about PyObject creation overhead. Also, I'm pretty sure strptime() will be much slower than PyObject creation (date parsing is surprisingly slow). diff -r 6168d4b93634 -r 8b6927eb7efd mercurial/util.py --- a/mercurial/util.py Sun Mar 12 21:53:03 2017 -0700 +++ b/mercurial/util.py Sun Mar 12 21:54:32 2017 -0700 @@ -1827,9 +1827,11 @@ return None, s -def strdate(string, format, defaults=[]): +def strdate(string, format, defaults=None): """parse a localized time string and return a (unixtime, offset) tuple. if the string cannot be parsed, ValueError is raised.""" + defaults = defaults or [] + # NOTE: unixtime = localunixtime + offset offset, date = parsetimezone(string)