diff options
| author | Jason R. Coombs <jaraco@jaraco.com> | 2019-09-03 21:37:24 -0400 |
|---|---|---|
| committer | Jason R. Coombs <jaraco@jaraco.com> | 2019-09-03 21:38:03 -0400 |
| commit | 1a6f0ecfe0cce4c628d35789fa72dc1ff14d66f4 (patch) | |
| tree | 02de6c241ff962f468f4e0ad067135811f2a2298 /cherrypy/lib | |
| parent | 86d9a291eb490f601cffb6ab773cca3a853b3432 (diff) | |
| parent | b68087d0d62a8817e90a509a89afad0268052bc2 (diff) | |
| download | cherrypy-git-1a6f0ecfe0cce4c628d35789fa72dc1ff14d66f4.tar.gz | |
Merge branch 'master' into bugfix/1779
Diffstat (limited to 'cherrypy/lib')
| -rw-r--r-- | cherrypy/lib/caching.py | 3 | ||||
| -rw-r--r-- | cherrypy/lib/cpstats.py | 2 | ||||
| -rw-r--r-- | cherrypy/lib/sessions.py | 2 |
3 files changed, 3 insertions, 4 deletions
diff --git a/cherrypy/lib/caching.py b/cherrypy/lib/caching.py index 38bd636e..08d2d8e4 100644 --- a/cherrypy/lib/caching.py +++ b/cherrypy/lib/caching.py @@ -196,8 +196,7 @@ class MemoryCache(Cache): now = time.time() # Must make a copy of expirations so it doesn't change size # during iteration - items = list(self.expirations.items()) - for expiration_time, objects in items: + for expiration_time, objects in self.expirations.copy().items(): if expiration_time <= now: for obj_size, uri, sel_header_values in objects: try: diff --git a/cherrypy/lib/cpstats.py b/cherrypy/lib/cpstats.py index 28510887..158b01a0 100644 --- a/cherrypy/lib/cpstats.py +++ b/cherrypy/lib/cpstats.py @@ -205,7 +205,7 @@ if not hasattr(logging, 'statistics'): def extrapolate_statistics(scope): """Return an extrapolated copy of the given scope.""" c = {} - for k, v in list(scope.items()): + for k, v in scope.copy().items(): if isinstance(v, dict): v = extrapolate_statistics(v) elif isinstance(v, (list, tuple)): diff --git a/cherrypy/lib/sessions.py b/cherrypy/lib/sessions.py index a089fc94..5b3328f2 100644 --- a/cherrypy/lib/sessions.py +++ b/cherrypy/lib/sessions.py @@ -403,7 +403,7 @@ class RamSession(Session): """Clean up expired sessions.""" now = self.now() - for _id, (data, expiration_time) in list(self.cache.items()): + for _id, (data, expiration_time) in self.cache.copy().items(): if expiration_time <= now: try: del self.cache[_id] |
