[issue3187] os.listdir can return byte strings

Guido van Rossum report at bugs.python.org
Fri Oct 3 20:52:02 CEST 2008


Guido van Rossum <guido at python.org> added the comment:

Sorry Amaury, but there's another issue.

test_ntpath now fails when run with -bb:

======================================================================
ERROR: test_expandvars (__main__.TestNtpath)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "Lib/test/test_ntpath.py", line 151, in test_expandvars
    tester('ntpath.expandvars("$foo bar")', "bar bar")
  File "Lib/test/test_ntpath.py", line 10, in tester
    gotResult = eval(fn)
  File "<string>", line 1, in <module>
  File "/usr/local/google/home/guido/python/py3k/Lib/ntpath.py", line
344, in expandvars
    if c in ('\'', b'\''):   # no expansion within single quotes
BytesWarning: Comparison between bytes and string

======================================================================
ERROR: test_normpath (__main__.TestNtpath)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "Lib/test/test_ntpath.py", line 120, in test_normpath
    tester("ntpath.normpath('A//////././//.//B')", r'A\B')
  File "Lib/test/test_ntpath.py", line 10, in tester
    gotResult = eval(fn)
  File "<string>", line 1, in <module>
  File "/usr/local/google/home/guido/python/py3k/Lib/ntpath.py", line
465, in normpath
    if comps[i] in ('.', '', b'.', b''):
BytesWarning: Comparison between bytes and string

======================================================================
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 10, in tester
    gotResult = eval(fn)
  File "<string>", line 1, in <module>
  File "/usr/local/google/home/guido/python/py3k/Lib/ntpath.py", line
534, in relpath
    start_list = abspath(start).split(sep)
  File "/usr/local/google/home/guido/python/py3k/Lib/ntpath.py", line
504, in abspath
    return normpath(path)
  File "/usr/local/google/home/guido/python/py3k/Lib/ntpath.py", line
465, in normpath
    if comps[i] in ('.', '', b'.', b''):
BytesWarning: Comparison between bytes and string

----------
assignee:  -> amaury.forgeotdarc

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue3187>
_______________________________________


More information about the Python-bugs-list mailing list