Hi all,
I'm playing with dicts that mangle the hash they receive before using it
for hashing. The goal was to detect obscure dict order dependencies in
my own programs, but I couldn't resist and ran the Python test suite
with various mangling schemes. As expected -- what is not tested is
broken -- I found and fixed tons of small dependencies in the tests
themselves, plus one in base64.py.
Now I'm stumbling upon this test for urllib2:
>>> mgr = urllib2.HTTPPasswordMgr()
>>> add = mgr.add_password
>>> add("Some Realm", "http://example.com/", "joe", "password")
>>> add("Some Realm", "http://example.com/ni", "ni", "ni")
(...)
Currently, we use the highest-level path where more than one
match:
>>> mgr.find_user_password("Some Realm", "http://example.com/ni")
('joe', 'password')
Returning the outermost path is a bit strange, if you ask me, but I am
no expert here. Stranger is the fact that the actual implement actually
returns, not the outermost path at all -- there is no code to do that --
but a random pick, the first match in dictionary order. The comment in
the test is just misleading. I believe that urllib2 should be fixed to
always return the *innermost* path, but I need confirmation about
this...
A bientot,
Armin
_______________________________________________
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com