[tor-commits] [stem/master] Avoid accidently clearing caches

atagar at torproject.org atagar at torproject.org
Sun Oct 22 01:16:00 UTC 2017


commit 73f9c23492dc7cde2dd5d7d6af40aa9715132e29
Author: Damian Johnson <atagar at torproject.org>
Date:   Sat Oct 21 11:05:10 2017 -0700

    Avoid accidently clearing caches
    
    Oops, a recent addition in commit 82a3cc0 can cause us to clear the cache when
    called without any parameters. What we actually meant there was to allow
    callers to explicitly clear, so checking for None instead.
---
 stem/control.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/stem/control.py b/stem/control.py
index 7b622aff..6746441c 100644
--- a/stem/control.py
+++ b/stem/control.py
@@ -3111,9 +3111,9 @@ class Controller(BaseController):
       if not self.is_caching_enabled():
         return
 
-      # if no params are provided then clear the namespace
+      # if params is None then clear the namespace
 
-      if not params and namespace:
+      if params is None and namespace:
         for cache_key in list(self._request_cache.keys()):
           if cache_key.startswith('%s.' % namespace):
             del self._request_cache[cache_key]



More information about the tor-commits mailing list