[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [bridgedb/develop] Fix octal numbers
commit e38377c267a6e3829bf191b19c8a8f3551c0b5c4
Author: Damian Johnson <atagar@xxxxxxxxxxxxxx>
Date: Fri Jan 10 14:30:59 2020 -0800
Fix octal numbers
Python changed its syntax for octal numbers...
https://stackoverflow.com/questions/11620151/what-do-numbers-starting-with-0-mean-in-python
This fixes exceptions such as...
Traceback (most recent call last):
File "/usr/local/lib/python3.5/dist-packages/twisted/trial/runner.py", line 823, in loadByName
return self.suiteFactory([self.findByName(name, recurse=recurse)])
...
File "/home/atagar/Desktop/tor/bridgedb/bridgedb/bridges.py", line 52, in <module>
from bridgedb import bridgerequest
File "/home/atagar/Desktop/tor/bridgedb/bridgedb/bridgerequest.py", line 27, in <module>
from bridgedb.crypto import getHMACFunc
builtins.SyntaxError: invalid token (crypto.py, line 105)
This didn't change the test outcome...
before: FAILED (skips=1, failures=7, errors=48, successes=256)
after: FAILED (skips=1, failures=7, errors=48, successes=256)
---
bridgedb/crypto.py | 4 ++--
bridgedb/test/test_captcha.py | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/bridgedb/crypto.py b/bridgedb/crypto.py
index ac2e3ec..ee9d099 100644
--- a/bridgedb/crypto.py
+++ b/bridgedb/crypto.py
@@ -89,7 +89,7 @@ class RSAKeyGenerationError(Exception):
def writeKeyToFile(key, filename):
- """Write **key** to **filename**, with ``0400`` permissions.
+ """Write **key** to **filename**, with ``400`` octal permissions.
If **filename** doesn't exist, it will be created. If it does exist
already, and is writable by the owner of the current process, then it will
@@ -102,7 +102,7 @@ def writeKeyToFile(key, filename):
"""
logging.info("Writing key to file: %r" % filename)
flags = os.O_WRONLY | os.O_TRUNC | os.O_CREAT | getattr(os, "O_BIN", 0)
- fd = os.open(filename, flags, 0400)
+ fd = os.open(filename, flags, 0o400)
os.write(fd, key)
os.fsync(fd)
os.close(fd)
diff --git a/bridgedb/test/test_captcha.py b/bridgedb/test/test_captcha.py
index 76f962e..281aadc 100644
--- a/bridgedb/test/test_captcha.py
+++ b/bridgedb/test/test_captcha.py
@@ -207,7 +207,7 @@ class GimpCaptchaTests(unittest.TestCase):
with open(badFile, 'w') as fh:
fh.write(' ')
fh.flush()
- os.chmod(badFile, 0266)
+ os.chmod(badFile, 0o266)
c = captcha.GimpCaptcha(self.publik, self.sekrit, self.hmacKey,
self.badCacheDir)
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits