diff --git a/changelog.d/3626.bugfix b/changelog.d/3626.bugfix new file mode 100644 index 0000000000000000000000000000000000000000..9a4b87898615ab07c36d08be3c6d0c3692b64cd3 --- /dev/null +++ b/changelog.d/3626.bugfix @@ -0,0 +1 @@ +Only import secrets when available (fix for py < 3.6) diff --git a/synapse/secrets.py b/synapse/secrets.py index f397daaa5edba77e931f5d5edbd59d49c9ee1f38..f05e9ea53595f6f9ba30193b43e52ad19e8b1445 100644 --- a/synapse/secrets.py +++ b/synapse/secrets.py @@ -20,17 +20,16 @@ See https://docs.python.org/3/library/secrets.html#module-secrets for the API used in Python 3.6, and the API emulated in Python 2.7. """ -import six +import sys -if six.PY3: +# secrets is available since python 3.6 +if sys.version_info[0:2] >= (3, 6): import secrets def Secrets(): return secrets - else: - import os import binascii