[New-bugs-announce] [issue21883] relpath: Provide better errors when mixing bytes and strings
Matt Bachmann
report at bugs.python.org
Mon Jun 30 05:12:55 CEST 2014
New submission from Matt Bachmann:
Howdy!
I encountered this error when accidently passing in mixed types to reldir
>>> import os
>>> os.path.relpath('/Users/bachmann', b'.')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/Cellar/python3/3.4.1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/posixpath.py", line 451, in relpath
start_list = [x for x in abspath(start).split(sep) if x]
TypeError: Type str doesn't support the buffer API
When this mistake is done in join we get a helpful error message.
I simply borrowed this logic and put in in relpath. Is this useful?
----------
components: Library (Lib)
messages: 221939
nosy: Matt.Bachmann
priority: normal
severity: normal
status: open
title: relpath: Provide better errors when mixing bytes and strings
type: enhancement
versions: Python 3.4
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue21883>
_______________________________________
More information about the New-bugs-announce
mailing list