[issue21127] Path objects cannot be constructed from str subclasses
Antony Lee
report at bugs.python.org
Fri Apr 11 19:41:53 CEST 2014
Antony Lee added the comment:
I am loading some structure from a MATLAB binary file using scipy.io.loadmat. This structure contains (in particular) paths (written as bytestrings) to other files which end up being loaded as numpy.str_ objects.
In fact, just trying to store and retrieve strings from numpy arrays wraps them in numpy.str_:
>>> import numpy
>>> type(numpy.array(["foo"])[0])
<class 'numpy.str_'>
... and now trying to construct a Path from that will crash.
I agree, though, that force-casting str subclasses in the constructor may avoid other issues.
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue21127>
_______________________________________
More information about the Python-bugs-list
mailing list