diff options
author | Eric Wieser <wieser.eric@gmail.com> | 2018-02-20 00:08:00 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-02-20 00:08:00 -0800 |
commit | 7ed541ce3a91eeeb951d9e5b000cd68ebbda794c (patch) | |
tree | 0bf18c04f08eff16ee69103e34365a4822a49820 /numpy/lib/npyio.py | |
parent | 71555c48be7f07833bd540dacb50deb8069b551f (diff) | |
parent | c45e445e9fe6bd264aba5a1736f0145ca7bdacc9 (diff) | |
download | numpy-7ed541ce3a91eeeb951d9e5b000cd68ebbda794c.tar.gz |
Merge pull request #10501 from msornay/fromregex-bytes
BUG: fromregex: asbytes called on regexp objects
Diffstat (limited to 'numpy/lib/npyio.py')
-rw-r--r-- | numpy/lib/npyio.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/numpy/lib/npyio.py b/numpy/lib/npyio.py index 73613d2a4..959574594 100644 --- a/numpy/lib/npyio.py +++ b/numpy/lib/npyio.py @@ -1465,9 +1465,9 @@ def fromregex(file, regexp, dtype, encoding=None): dtype = np.dtype(dtype) content = file.read() - if isinstance(content, bytes) and not isinstance(regexp, bytes): + if isinstance(content, bytes) and isinstance(regexp, np.unicode): regexp = asbytes(regexp) - elif not isinstance(content, bytes) and isinstance(regexp, bytes): + elif isinstance(content, np.unicode) and isinstance(regexp, bytes): regexp = asstr(regexp) if not hasattr(regexp, 'match'): |