[issue27232] os.fspath() should not use repr() on error

Jelle Zijlstra report at bugs.python.org
Mon Jun 6 09:55:27 EDT 2016


Jelle Zijlstra added the comment:

No, that issue just adds the address to the repr() of types. It is not normal to use repr for type objects in error messages:

>>> int(None)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: int() argument must be a string, a bytes-like object or a number, not 'NoneType'
>>> open(None, 0)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: open() argument 2 must be str, not int
>>> os.fspath(None)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: expected str, bytes or os.PathLike object, not <class 'NoneType' at 0x1086bb638>

----------

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


More information about the Python-bugs-list mailing list