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 <rep...@bugs.python.org>
<http://bugs.python.org/issue21127>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to