summaryrefslogtreecommitdiff
path: root/numpy/lib
diff options
context:
space:
mode:
Diffstat (limited to 'numpy/lib')
-rw-r--r--numpy/lib/_iotools.py11
-rw-r--r--numpy/lib/tests/test_io.py3
2 files changed, 11 insertions, 3 deletions
diff --git a/numpy/lib/_iotools.py b/numpy/lib/_iotools.py
index 7921b4116..2f2a4bc57 100644
--- a/numpy/lib/_iotools.py
+++ b/numpy/lib/_iotools.py
@@ -203,13 +203,17 @@ class LineSplitter(object):
self._handyman = _handyman
#
def _delimited_splitter(self, line):
- line = line.split(self.comments)[0].strip(asbytes(" \r\n"))
+ if self.comments is not None:
+ line = line.split(self.comments)[0]
+ line = line.strip(asbytes(" \r\n"))
if not line:
return []
return line.split(self.delimiter)
#
def _fixedwidth_splitter(self, line):
- line = line.split(self.comments)[0].strip(asbytes("\r\n"))
+ if self.comments is not None:
+ line = line.split(self.comments)[0]
+ line = line.strip(asbytes("\r\n"))
if not line:
return []
fixed = self.delimiter
@@ -217,7 +221,8 @@ class LineSplitter(object):
return [line[s] for s in slices]
#
def _variablewidth_splitter(self, line):
- line = line.split(self.comments)[0]
+ if self.comments is not None:
+ line = line.split(self.comments)[0]
if not line:
return []
slices = self.delimiter
diff --git a/numpy/lib/tests/test_io.py b/numpy/lib/tests/test_io.py
index aeda7663c..0762c82e1 100644
--- a/numpy/lib/tests/test_io.py
+++ b/numpy/lib/tests/test_io.py
@@ -1454,6 +1454,9 @@ M 33 21.99
test = np.genfromtxt(StringIO("test1,testNonetherestofthedata"),
dtype=None, comments=None, delimiter=',')
assert_equal(test[1], asbytes('testNonetherestofthedata'))
+ test = np.genfromtxt(StringIO("test1, testNonetherestofthedata"),
+ dtype=None, comments=None, delimiter=',')
+ assert_equal(test[1], asbytes(' testNonetherestofthedata'))
def test_recfromtxt(self):
#