fix "RuntimeError: dictionary changed size during iteration"
@@ -95,7 +95,7 @@ class SPSA(Optimizer):
'You should use maxiter instead.',
DeprecationWarning)
maxiter = max_trials
- for k, v in locals().items():
+ for k, v in list(locals().items()):
if k in self._OPTIONS:
self._options[k] = v
self._maxiter = maxiter
