Skip to content

Commit

Permalink
Fix BigInt parser. Add test for readdlm(BigInt)
Browse files Browse the repository at this point in the history
  • Loading branch information
yuyichao committed Oct 7, 2015
1 parent 930e6b5 commit eaf5532
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion base/gmp.jl
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ function tryparse_internal(::Type{BigInt}, s::AbstractString, startpos::Int, end
_n = Nullable{BigInt}()

# don't make a copy in the common case where we are parsing a whole bytestring
bstr = startpos == start(s) && endpos == endof(s) ? bytestring(s) : bytestring(SubString(s,i,endpos))
bstr = startpos == start(s) && endpos == endof(s) ? bytestring(s) : bytestring(SubString(s,startpos,endpos))

sgn, base, i = Base.parseint_preamble(true,base,bstr,start(bstr),endof(bstr))
if i == 0
Expand Down
5 changes: 5 additions & 0 deletions test/readdlm.jl
Original file line number Diff line number Diff line change
Expand Up @@ -228,3 +228,8 @@ end

# fix #13179 parsing unicode lines with default delmiters
@test isequaldlm(readdlm(IOBuffer("# Should ignore this π\n1\tα\n2\tβ\n")), Any[1 "α"; 2 "β"], Any)

# BigInt parser
let data = "1 2 3"
readdlm(IOBuffer(data), ' ', BigInt) == BigInt[1 2 3]
end

0 comments on commit eaf5532

Please sign in to comment.