Skip to content

Commit 2ec7e7c

Browse files
committed
Fixes
1 parent 2e2a694 commit 2ec7e7c

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

base/printf.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ module Printf
44

55
using .Base.Ryu
66

7-
export @printf, @sprintf
7+
export @printf, @sprintf, Format, format, @format
88

99
const Ints = Union{Val{'d'}, Val{'i'}, Val{'u'}, Val{'x'}, Val{'X'}, Val{'o'}}
1010
const Floats = Union{Val{'e'}, Val{'E'}, Val{'f'}, Val{'F'}, Val{'g'}, Val{'G'}, Val{'a'}, Val{'A'}}
@@ -118,7 +118,7 @@ function Format(f::AbstractString)
118118
pos += 1
119119
end
120120
# parse type
121-
!(b in b"diouxXDOUeEfFgGaAcCsSpn") && throw(ArgumentError("invalid format string: '$f'"))
121+
!(b in b"diouxXDOUeEfFgGaAcCsSpn") && throw(ArgumentError("invalid format string: '$f', invalid type specifier: '$(Char(b))'"))
122122
type = Val{Char(b)}
123123
if type <: Ints && precision > 0
124124
zero = false
@@ -428,17 +428,17 @@ macro printf(io_or_fmt, fmt_or_first_arg, args...)
428428
if io_or_fmt isa String
429429
io = stdout
430430
fmt = Format(io_or_fmt)
431-
return esc(:(Printf.format($io, $fmt, $fmt_or_first_arg, $(args...))))
431+
return esc(:(Base.Printf.format($io, $fmt, $fmt_or_first_arg, $(args...))))
432432
else
433433
io = io_or_fmt
434434
fmt = Format(fmt_or_first_arg)
435-
return esc(:(Printf.format($io, $fmt, $(args...))))
435+
return esc(:(Base.Printf.format($io, $fmt, $(args...))))
436436
end
437437
end
438438

439439
macro sprintf(fmt, args...)
440440
f = Format(fmt)
441-
return esc(:(Printf.format($f, $(args...))))
441+
return esc(:(Base.Printf.format($f, $(args...))))
442442
end
443443

444444
end # module

contrib/generate_precompile.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,9 @@ function generate_precompile_statements()
137137
# Extract the precompile statements from stderr
138138
statements = Set{String}()
139139
for statement in eachline(precompile_file_h)
140-
(occursin("Main.", statement) || occursin("Printf.", statement)) && continue
140+
(occursin("Main.", statement) ||
141+
occursin("Printf.", statement) ||
142+
occursin("Base.io_has_tvar_name", statement)) && continue
141143
# check for `#x##s66` style variable names not in quotes
142144
occursin(r"#\w", statement) &&
143145
count(r"(?:#+\w+)+", statement) !=

0 commit comments

Comments
 (0)