Skip to content

Commit a1602a4

Browse files
timholyantoine-levitt
authored andcommitted
Protect handle_message from Integer subtype invalidation (JuliaLang#39689)
Resolves JuliaArrays/ArrayInterface.jl#121. There is a cost, but hopefully there's no strong need to supply `maxlog` using whacky subtypes of Integer.
1 parent d7ca737 commit a1602a4

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

base/logging.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -638,7 +638,7 @@ function handle_message(logger::SimpleLogger, level::LogLevel, message, _module,
638638
filepath, line; kwargs...)
639639
@nospecialize
640640
maxlog = get(kwargs, :maxlog, nothing)
641-
if maxlog isa Integer
641+
if maxlog isa Core.BuiltinInts
642642
remaining = get!(logger.message_limits, id, Int(maxlog)::Int)
643643
logger.message_limits[id] = remaining - 1
644644
remaining > 0 || return

stdlib/Logging/src/ConsoleLogger.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ function handle_message(logger::ConsoleLogger, level::LogLevel, message, _module
101101
@nospecialize
102102
hasmaxlog = haskey(kwargs, :maxlog) ? 1 : 0
103103
maxlog = get(kwargs, :maxlog, nothing)
104-
if maxlog isa Integer
104+
if maxlog isa Core.BuiltinInts
105105
remaining = get!(logger.message_limits, id, Int(maxlog)::Int)
106106
logger.message_limits[id] = remaining - 1
107107
remaining > 0 || return

0 commit comments

Comments
 (0)