mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2024-10-01 11:49:51 -04:00
Only import secrets when available
secrets got introduced in python 3.6 so this class is not available in 3.5 and before. This now checks for the current running version and only tries using secrets if the version is 3.6 or above Signed-Off-By: Matthias Kesler <krombel@krombel.de>
This commit is contained in:
parent
e9b2d047f6
commit
254e8267e2
1
changelog.d/3626.bugfix
Normal file
1
changelog.d/3626.bugfix
Normal file
@ -0,0 +1 @@
|
||||
Only import secrets when available (fix for py < 3.6)
|
@ -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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user