[tor-commits] [stem/master] Fix open call during hash verification.

atagar at torproject.org atagar at torproject.org
Sat Aug 8 00:14:15 UTC 2020


commit 1da1a1787406e9e2218e0bd0248ff9fabf1228de
Author: Kevin <smeatsan at gmail.com>
Date:   Tue Aug 4 12:10:52 2020 +0200

    Fix open call during hash verification.
    
    "open" needs one of create/read/write/append
    
    https://github.com/torproject/stem/pull/72
---
 stem/descriptor/collector.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/stem/descriptor/collector.py b/stem/descriptor/collector.py
index 865fc1eb..8c05a832 100644
--- a/stem/descriptor/collector.py
+++ b/stem/descriptor/collector.py
@@ -325,7 +325,7 @@ class File(object):
     # check if this file already exists with the correct checksum
 
     if os.path.exists(path):
-      with open(path, 'b') as prior_file:
+      with open(path, 'rb') as prior_file:
         expected_hash = binascii.hexlify(base64.b64decode(self.sha256)).decode('utf-8')
         actual_hash = hashlib.sha256(prior_file.read()).hexdigest()
 



More information about the tor-commits mailing list