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.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4