[New-bugs-announce] [issue21127] Path objects cannot be constructed from str subclasses
Antony Lee
report at bugs.python.org
Wed Apr 2 00:08:28 CEST 2014
New submission from Antony Lee:
Trying to construct a Path object from a str subclass, e.g.
class S(str): pass
Path(S("foo"))
fails because the subclass cannot be interned. I think that the interning should simply be removed for non-exactly-str arguments (it is only here for performance reasons, right?), or at least the error should be more explicit (note, in particular, that there is no error if one tries 'Path(S("foo/bar"))' instead, which only confuses the matter more).
In practice, I found out this via numpy, which provides its own str subclass, numpy.str_.
----------
components: Library (Lib)
messages: 215342
nosy: Antony.Lee
priority: normal
severity: normal
status: open
title: Path objects cannot be constructed from str subclasses
versions: Python 3.5
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue21127>
_______________________________________
More information about the New-bugs-announce
mailing list