summaryrefslogtreecommitdiff
path: root/numpy/lib/npyio.py
diff options
context:
space:
mode:
authorRoss Barnowski <rossbar@berkeley.edu>2022-01-28 12:16:00 -0800
committerSebastian Berg <sebastian@sipsolutions.net>2022-01-28 15:06:49 -0600
commit8a31abccb1928d3ca1e669e105020f3a21dfb1a8 (patch)
treecca597703c0f371887c7ca9d6ca4b1e2faf9220f /numpy/lib/npyio.py
parent370792b3929aa9c66403c9509f08cb7921347352 (diff)
downloadnumpy-8a31abccb1928d3ca1e669e105020f3a21dfb1a8.tar.gz
Add test for empty string as control characters.
Includes comments param, which is handled on the Python side.
Diffstat (limited to 'numpy/lib/npyio.py')
-rw-r--r--numpy/lib/npyio.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/numpy/lib/npyio.py b/numpy/lib/npyio.py
index be313d104..63fffffbc 100644
--- a/numpy/lib/npyio.py
+++ b/numpy/lib/npyio.py
@@ -922,6 +922,11 @@ def _read(fname, *, delimiter=',', comment='#', quote='"',
comments = None
else:
# assume comments are a sequence of strings
+ if "" in comment:
+ raise ValueError(
+ "comments cannot be an empty string. Use comments=None to "
+ "disable comments."
+ )
comments = tuple(comment)
comment = None
if len(comments) == 0: