Printf is broken with BigInt on master

I noticed this when answering a question here on Discourse:

julia> @printf("%d", big(1))
ERROR: UndefVarError: GMP not defined
Stacktrace:
 [1] decode(::Int64, ::BigInt) at ./printf.jl:884
 [2] decode_dec(::Base.TTY, ::BigInt, ::String, ::Int64, ::Int64, ::Char) at ./printf.jl:798

This was broken by the change: https://github.com/JuliaLang/julia/pull/21654
(apparently, there are no unit tests for printf on BigInt that hit the two functions where this got broken)

1 Like

Note: the fix for this is simply to add:

using Base.GMP: MPZ

on line 4 after:

module Printf

Thanks Scott! And sorry for the inconvenience. Fix at https://github.com/JuliaLang/julia/pull/22104.

1 Like