﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
28796	"reverse() coerces bytes in args/kwargs to str which adds ""b"" prefixes to the ouput"	Nick	nobody	"Suppose we have:
{{{
import hmac
from hashlib import sha384
from django.utils.http import urlsafe_base64_encode

hashed_msg = hmac.new(b""secret"", msg=b""qwerty"", digestmod=sha384)
url = urlsafe_base64_encode(hashed_msg.digest())
}}}
Now url is a bytes object, say b'asdfwerqwefa'. In django 1.11, bytes-like objects could be used in `reverse()`, creating (say) localhost:8000/asdfwerqwefa

However, in Django 2.0, the url becomes (say)

localhost:8000/b&#39;asdfwerqwefa&#39;

which seems less 'urlsafe', as the quotes and the 'b' are added into the url. Shouldn't urlsafe_base64_encode now return a string, if bytes in urls now retain the quotes?

I have created a full project which reproduces the bug here:

https://github.com/NAThompson/urlsafe_bug

To reproduce the bug, type:
{{{
$ ./manage.py shell
>>> import reproduce
}}}

This bug is present in commit d90936f41a2d7a3361e51fc49be033ba0f05f458, but much before that the 'django.urls.path' doesn't exist, so bisection doesn't work cleanly."	Bug	new	Core (URLs)	2.0	Normal			nathompson7@…	Unreviewed	0	0	0	0	0	0
