facebook/tornado — pull request #581 by wynemo (2012-08-10 15:20:26+00:00)
Title: Fix in python3 _oauth_signature get invalid signature problem

in python3, in the following statement

oauth_nonce=binascii.b2a_hex(uuid.uuid4().bytes),

oauth_nonce 's type is bytes,
and in function _oauth_signature and _oauth10a_signature ,the following statement

base_elems.append("&".join("%s=%s" % (k, _oauth_escape(str(v)))
for k, v in sorted(parameters.items())))

use _oauth_escape(str(v)),when v 's type is bytes, str() will append b to the string

example:

>>> print(str(binascii.b2a_hex(uuid.uuid4().bytes)))
b'e72a84e922ac4d43a0186f1caa3c9c94'

so function _oauth_signature will return invalid signature

should convert oauth_nonce's type to str in python3(to unicode in python2 for compatibility)