Message74256
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! |
|
Date |
User |
Action |
Args |
2008-10-03 16:34:58 | gvanrossum | set | recipients:
+ gvanrossum, loewis, georg.brandl, amaury.forgeotdarc, pitrou, vstinner, draghuram, benjamin.peterson, djc, HWJ, dlitz, zegreek, bboissin |
2008-10-03 16:34:58 | gvanrossum | set | messageid: <1223051698.05.0.0287230053704.issue3187@psf.upfronthosting.co.za> |
2008-10-03 16:34:57 | gvanrossum | link | issue3187 messages |
2008-10-03 16:34:56 | gvanrossum | create | |
|