[issue21343] os.path.relpath returns inconsistent types

Matt Bachmann report at bugs.python.org
Sun May 25 17:21:42 CEST 2014


Matt Bachmann added the comment:

Perhaps this is the bug I should be filing but here is why this comes up for me. 

I get different output from this function if I pass in two types.

On my machine:
os.path.relpath(u'test_srcl.txt', u'.') returns u'test_src.txt'
os.path.relpath(u'test_srcl.txt', '.') returns u'../../Users/bachmann/Code/diff-cover/diff_cover/tests/fixtures/test_src.txt'

I make a couple calls to this function, if the first call gives me back a byte string and I pass it to the second call I get the incorrect result. So I need to decode.

If the function always gave back the same type as I gave it I would not have this issue.

----------

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


More information about the Python-bugs-list mailing list