[tor-commits] [stem/master] Avoiding address type query for cached get_mask() requests

atagar at torproject.org atagar at torproject.org
Fri Dec 7 17:14:39 UTC 2012


commit 9c0cc18909a1dd16cc810cf3178acfbcb0bc064f
Author: Damian Johnson <atagar at torproject.org>
Date:   Fri Dec 7 07:22:43 2012 -0800

    Avoiding address type query for cached get_mask() requests
    
    Oops. There's no reason to call get_address_type() when we already have a
    lazily loaded _mask attribute.
---
 stem/exit_policy.py |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/stem/exit_policy.py b/stem/exit_policy.py
index f9f0eb8..6aaa4cc 100644
--- a/stem/exit_policy.py
+++ b/stem/exit_policy.py
@@ -489,9 +489,9 @@ class ExitPolicyRule(object):
     # Lazy loading our mask because it very infrequently requested. There's
     # no reason to usually usse memory for it.
     
-    address_type = self.get_address_type()
-    
     if not self._mask:
+      address_type = self.get_address_type()
+      
       if address_type == AddressType.WILDCARD:
         mask = None
       elif address_type == AddressType.IPv4:





More information about the tor-commits mailing list