Guido van Rossum wrote: > I wonder if it wouldn't make sense to change urlencode() to generate > URLs that don't depend on the hash order, for all versions of Python > that support PYTHONHASHSEED? It seems a one-line fix: > > query = query.items() > > with this: > > query = sorted(query.items()) > > This would not prevent breakage of unit tests, but it would make a > much simpler fix possible: simply sort the parameters in the URL. > > Thoughts?
There may be people who mix bytes and str or pass other non-str keys: >>> query = {b"a":b"b", "c":"d", 5:6} >>> urlencode(query) 'a=b&c=d&5=6' >>> sorted(query.items()) Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: unorderable types: str() < bytes() Not pretty, but a bugfix should not break such constructs. _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com