Merge pull request #474 from oddstr13/pr-websocket-3.9-1

Fix: array.array.tostring is removed in Python 3.9
This commit is contained in:
mcarlton00 2021-02-22 17:29:18 -05:00 committed by GitHub
commit 84f6b238c6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -36,6 +36,7 @@ except ImportError:
import os
import sys
import array
import struct
import uuid
@ -357,6 +358,10 @@ class ABNF(object):
_d = array.array("B", data)
for i in range(len(_d)):
_d[i] ^= _m[i % 4]
if sys.version_info >= (3, 2):
return _d.tobytes()
else:
return _d.tostring()