Skip to content

Commit 2c02394

Browse files
authored
Fix auto bool detection (#980)
1 parent 4fb9b0e commit 2c02394

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/utils.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -513,7 +513,7 @@ end
513513
end
514514
bool = Parsers.xparse(Bool, buf, pos, len, opts)
515515
code, tlen = bool.code, bool.tlen
516-
if Parsers.ok(code) && (ensure_full_buf_consumed == ((pos + tlen - 1) == len))
516+
if Parsers.ok(code) && (!ensure_full_buf_consumed || (ensure_full_buf_consumed == ((pos + tlen - 1) == len)))
517517
return cb(code, tlen, bool.val, BOOL)
518518
end
519519
return cb(code, tlen, nothing, STRING)

test/basics.jl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -773,4 +773,8 @@ f = CSV.File(IOBuffer(data); delim='|', stripwhitespace=true)
773773
f = CSV.File(IOBuffer(join((rand(("a,$(rand())", "b,$(rand())")) for _ = 1:10^6), "\n")), header=false, limit=10000)
774774
@test length(f) == 10000
775775

776+
# fix bool detection
777+
f = CSV.File(IOBuffer("a\nfalse\n"))
778+
@test eltype(f.a) == Bool
779+
776780
end

0 commit comments

Comments
 (0)