On 11/4/07, christian.heimes <[email protected]> wrote:
> Author: christian.heimes
> Date: Sun Nov  4 21:42:13 2007
> New Revision: 58846
>
> Modified:
>    python/branches/py3k-pep3137/Lib/test/test_urllib2.py
>    python/branches/py3k-pep3137/Lib/urllib2.py
> Log:
> Fixed bug in urllib2
> str(b) == b is causing some bugs and maybe hiding some more. I'm not sure if 
> it was a wise idea to allow it.

I don't understand this comment. When is str(b) == b except when b is
a str instance?

> Modified: python/branches/py3k-pep3137/Lib/test/test_urllib2.py
> ==============================================================================
> --- python/branches/py3k-pep3137/Lib/test/test_urllib2.py       (original)
> +++ python/branches/py3k-pep3137/Lib/test/test_urllib2.py       Sun Nov  4 
> 21:42:13 2007
> @@ -999,7 +999,8 @@
>          self.assertEqual(len(http_handler.requests), 2)
>          self.assertFalse(http_handler.requests[0].has_header(auth_header))
>          userpass = bytes('%s:%s' % (user, password), "ascii")
> -        auth_hdr_value = 'Basic ' + 
> str(base64.encodestring(userpass)).strip()
> +        auth_hdr_value = ('Basic ' +
> +            base64.encodestring(userpass).strip().decode())
>          self.assertEqual(http_handler.requests[1].get_header(auth_header),
>                           auth_hdr_value)
>
>
> Modified: python/branches/py3k-pep3137/Lib/urllib2.py
> ==============================================================================
> --- python/branches/py3k-pep3137/Lib/urllib2.py (original)
> +++ python/branches/py3k-pep3137/Lib/urllib2.py Sun Nov  4 21:42:13 2007
> @@ -802,7 +802,7 @@
>          user, pw = self.passwd.find_user_password(realm, host)
>          if pw is not None:
>              raw = "%s:%s" % (user, pw)
> -            auth = 'Basic %s' % str(base64.b64encode(raw)).strip()
> +            auth = 'Basic %s' % base64.b64encode(raw).strip().decode()
>              if req.headers.get(self.auth_header, None) == auth:
>                  return None
>              req.add_header(self.auth_header, auth)
> _______________________________________________
> Python-3000-checkins mailing list
> [email protected]
> http://mail.python.org/mailman/listinfo/python-3000-checkins
>


-- 
--Guido van Rossum (home page: http://www.python.org/~guido/)
_______________________________________________
Python-3000-checkins mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-3000-checkins

Reply via email to