[Python-checkins] cpython (merge 3.2 -> default): merge from 3.2.

Brett Cannon brett at python.org
Thu Apr 14 20:53:56 CEST 2011


I think you have the wrong issue #; that one has to do with string
exceptions.

On Wed, Apr 13, 2011 at 22:21, senthil.kumaran
<python-checkins at python.org>wrote:

> http://hg.python.org/cpython/rev/7563f10275a2
> changeset:   69350:7563f10275a2
> parent:      69344:1f767f834e67
> parent:      69349:37d1b749eebb
> user:        Senthil Kumaran <orsenthil at gmail.com>
> date:        Thu Apr 14 13:20:41 2011 +0800
> summary:
>  merge from 3.2.
>
> Fix closes Issue1147.
>
> files:
>  Lib/nturl2path.py       |   5 ++++-
>  Lib/test/test_urllib.py |  18 ++++++++++++++++++
>  Misc/NEWS               |   3 +++
>  3 files changed, 25 insertions(+), 1 deletions(-)
>
>
> diff --git a/Lib/nturl2path.py b/Lib/nturl2path.py
> --- a/Lib/nturl2path.py
> +++ b/Lib/nturl2path.py
> @@ -27,9 +27,12 @@
>     drive = comp[0][-1].upper()
>     components = comp[1].split('/')
>     path = drive + ':'
> -    for  comp in components:
> +    for comp in components:
>         if comp:
>             path = path + '\\' + urllib.parse.unquote(comp)
> +    # Issue #11474 - handing url such as |c/|
> +    if path.endswith(':') and url.endswith('/'):
> +        path += '\\'
>     return path
>
>  def pathname2url(p):
> diff --git a/Lib/test/test_urllib.py b/Lib/test/test_urllib.py
> --- a/Lib/test/test_urllib.py
> +++ b/Lib/test/test_urllib.py
> @@ -9,6 +9,7 @@
>  import unittest
>  from test import support
>  import os
> +import sys
>  import tempfile
>
>  def hexescape(char):
> @@ -1021,6 +1022,23 @@
>                          "url2pathname() failed; %s != %s" %
>                          (expect, result))
>
> +    @unittest.skipUnless(sys.platform == 'win32',
> +                         'test specific to the urllib.url2path function.')
> +    def test_ntpath(self):
> +        given = ('/C:/', '///C:/', '/C|//')
> +        expect = 'C:\\'
> +        for url in given:
> +            result = urllib.request.url2pathname(url)
> +            self.assertEqual(expect, result,
> +                             'urllib.request..url2pathname() failed; %s !=
> %s' %
> +                             (expect, result))
> +        given = '///C|/path'
> +        expect = 'C:\\path'
> +        result = urllib.request.url2pathname(given)
> +        self.assertEqual(expect, result,
> +                         'urllib.request.url2pathname() failed; %s != %s'
> %
> +                         (expect, result))
> +
>  class Utility_Tests(unittest.TestCase):
>     """Testcase to test the various utility functions in the urllib."""
>
> diff --git a/Misc/NEWS b/Misc/NEWS
> --- a/Misc/NEWS
> +++ b/Misc/NEWS
> @@ -103,6 +103,9 @@
>  Library
>  -------
>
> +- Issue #11474: Fix the bug with url2pathname() handling of '/C|/' on
> Windows.
> +  Patch by Santoso Wijaya.
> +
>  - Issue #11684: complete email.parser bytes API by adding
> BytesHeaderParser.
>
>  - The bz2 module now handles 4GiB+ input buffers correctly.
>
> --
> Repository URL: http://hg.python.org/cpython
>
> _______________________________________________
> Python-checkins mailing list
> Python-checkins at python.org
> http://mail.python.org/mailman/listinfo/python-checkins
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-checkins/attachments/20110414/51186587/attachment.html>


More information about the Python-checkins mailing list