[tor-commits] [chutney/master] Python3 fix: open /dev/urandom in binary mode.

nickm at torproject.org nickm at torproject.org
Mon Mar 11 00:33:44 UTC 2019


commit c7c0974d1736581cdb6cde473a468fab3d1ab964
Author: Nick Mathewson <nickm at torproject.org>
Date:   Thu Feb 28 12:18:14 2019 -0500

    Python3 fix: open /dev/urandom in binary mode.
    
    We should really be using os.urandom(), but I'm going for small
    fixes here.
---
 scripts/chutney_tests/verify.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/chutney_tests/verify.py b/scripts/chutney_tests/verify.py
index 063bf8f..82394d2 100644
--- a/scripts/chutney_tests/verify.py
+++ b/scripts/chutney_tests/verify.py
@@ -54,7 +54,7 @@ def _verify_traffic(network):
         dot_reps = _calculate_reps(DOTDATALEN, randomlen)
         # make sure we get at least one dot per transmission
         dot_reps = min(reps, dot_reps)
-        with open('/dev/urandom', 'r') as randfp:
+        with open('/dev/urandom', 'rb') as randfp:
             tmpdata = randfp.read(randomlen)
     else:
         dot_reps = 0





More information about the tor-commits mailing list