cmdstate: avoid setting a default argument to a mutable object (`{}`)
If there's ever more than one cmdstate for the lifetime of the process, this can
cause surprising behavior where the later cmdstates pick up options from the
earlier ones.
I've not seen any evidence this is actually causing any issues, but it's subtle
enough that it should probably be fixed to help save significant debugging time
later.
--- a/hgext3rd/evolve/state.py Mon Sep 16 12:42:11 2019 -0700
+++ b/hgext3rd/evolve/state.py Mon Sep 16 12:42:50 2019 -0700
@@ -37,9 +37,11 @@
can populate the object data reading that file
"""
- def __init__(self, repo, path=b'evolvestate', opts={}):
+ def __init__(self, repo, path=b'evolvestate', opts=None):
self._repo = repo
self.path = path
+ if opts is None:
+ opts = {}
self.opts = opts
def __nonzero__(self):