This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author gvanrossum
Recipients HWJ, amaury.forgeotdarc, bboissin, benjamin.peterson, djc, dlitz, draghuram, georg.brandl, gvanrossum, loewis, pitrou, vstinner, zegreek
Date 2008-10-03.16:34:56
SpamBayes Score 8.354428e-13
Marked as misclassified No
Message-id <1223051698.05.0.0287230053704.issue3187@psf.upfronthosting.co.za>
In-reply-to
Content
Reducing priority to critical, it's just docs and tweaks from here.

 You should also support bytearray() in ntpath:
>    isinstance(path, (bytes, bytearray))

No, you shouldn't.  I changed my mind on this several times and in the
end figured it's good enough to just support bytes and str instances.

Amaury: I've reviewed your patch and ran test_ntpath.py on a Linux box.
 I get this traceback:

======================================================================
ERROR: test_relpath (__main__.TestNtpath)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "Lib/test/test_ntpath.py", line 188, in test_relpath
    tester('ntpath.relpath("a")', 'a')
  File "Lib/test/test_ntpath.py", line 22, in tester
    gotResult = eval(fn)
  File "<string>", line 1, in <module>
  File "/usr/local/google/home/guido/python/py3k/Lib/ntpath.py", line
530, in relpath
    start_list = abspath(start).split(sep)
  File "/usr/local/google/home/guido/python/py3k/Lib/ntpath.py", line
499, in abspath
    path = join(os.getcwd(), path)
  File "/usr/local/google/home/guido/python/py3k/Lib/ntpath.py", line
137, in join
    if b[:1] in seps:
TypeError: 'in <string>' requires string as left operand, not bytes
----------------------------------------------------------------------

The fix is to change the fallback abspath to this code:

    def abspath(path):
        """Return the absolute version of a path."""
        if not isabs(path):
            if isinstance(path, bytes):
                cwd = os.getcwdb()
            else:
                cwd = os.getcwd()
            path = join(cwd, path)
        return normpath(path)

Once you fix that please check it in!
History
Date User Action Args
2008-10-03 16:34:58gvanrossumsetrecipients: + gvanrossum, loewis, georg.brandl, amaury.forgeotdarc, pitrou, vstinner, draghuram, benjamin.peterson, djc, HWJ, dlitz, zegreek, bboissin
2008-10-03 16:34:58gvanrossumsetmessageid: <1223051698.05.0.0287230053704.issue3187@psf.upfronthosting.co.za>
2008-10-03 16:34:57gvanrossumlinkissue3187 messages
2008-10-03 16:34:56gvanrossumcreate