Skip to content

Commit

Permalink
fix JuliaLang#5133, BigInt serialization regression
Browse files Browse the repository at this point in the history
  • Loading branch information
JeffBezanson committed Dec 14, 2013
1 parent 2e56f22 commit f60db95
Show file tree
Hide file tree
Showing 2 changed files with 9 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 @@ -143,7 +143,7 @@ function serialize(s, n::BigInt)
serialize(s, base(62,n))
end

deserialize(s, ::Type{BigInt}) = parseint(BigInt, deserialize(s), 62)
deserialize(s, ::Type{BigInt}) = Base.parseint_nocheck(BigInt, deserialize(s), 62)

# Binary ops
for (fJ, fC) in ((:+, :add), (:-,:sub), (:*, :mul),
Expand Down
8 changes: 8 additions & 0 deletions test/bigint.jl
Original file line number Diff line number Diff line change
Expand Up @@ -253,3 +253,11 @@ s = string(n)
@test length(s) == 208988
@test endswith(s, "359244926937501")
@test beginswith(s, "316047687386689")

# serialization (#5133)
let
b = IOBuffer()
serialize(b, big(2)^100)
seek(b,0)
@test deserialize(b) == big(2)^100
end

0 comments on commit f60db95

Please sign in to comment.