@@ -362,6 +362,13 @@ function showerror_nostdio(err, msg::AbstractString)
362
362
ccall (:jl_printf , Cint, (Ptr{Cvoid},Cstring), stderr_stream, " \n " )
363
363
end
364
364
365
+ stacktrace_expand_basepaths ():: Bool =
366
+ tryparse (Bool, get (ENV , " JULIA_STACKTRACE_EXPAND_BASEPATHS" , " false" )) === true
367
+ stacktrace_contract_userdir ():: Bool =
368
+ tryparse (Bool, get (ENV , " JULIA_STACKTRACE_CONTRACT_HOMEDIR" , " true" )) === true
369
+ stacktrace_linebreaks ():: Bool =
370
+ tryparse (Bool, get (ENV , " JULIA_STACKTRACE_LINEBREAKS" , " false" )) === true
371
+
365
372
function show_method_candidates (io:: IO , ex:: MethodError , @nospecialize kwargs= ())
366
373
is_arg_types = isa (ex. args, DataType)
367
374
arg_types = is_arg_types ? ex. args : typesof (ex. args... )
@@ -489,7 +496,12 @@ function show_method_candidates(io::IO, ex::MethodError, @nospecialize kwargs=()
489
496
end
490
497
print (iob, " )" )
491
498
show_method_params (iob0, tv)
492
- print (iob, " at " , method. file, " :" , method. line)
499
+ file, line = functionloc (method)
500
+ if file === nothing
501
+ file = string (method. file)
502
+ end
503
+ stacktrace_contract_userdir () && (file = contractuser (file))
504
+ print (iob, " at " , file, " :" , line)
493
505
if ! isempty (kwargs):: Bool
494
506
unexpected = Symbol[]
495
507
if isempty (kwords) || ! (any (endswith (string (kword), " ..." ) for kword in kwords))
@@ -549,13 +561,6 @@ const update_stackframes_callback = Ref{Function}(identity)
549
561
const STACKTRACE_MODULECOLORS = [:magenta , :cyan , :green , :yellow ]
550
562
const STACKTRACE_FIXEDCOLORS = IdDict (Base => :light_black , Core => :light_black )
551
563
552
- stacktrace_expand_basepaths ():: Bool =
553
- tryparse (Bool, get (ENV , " JULIA_STACKTRACE_EXPAND_BASEPATHS" , " false" )) === true
554
- stacktrace_contract_userdir ():: Bool =
555
- tryparse (Bool, get (ENV , " JULIA_STACKTRACE_CONTRACT_HOMEDIR" , " true" )) === true
556
- stacktrace_linebreaks ():: Bool =
557
- tryparse (Bool, get (ENV , " JULIA_STACKTRACE_LINEBREAKS" , " false" )) === true
558
-
559
564
function show_full_backtrace (io:: IO , trace:: Vector ; print_linebreaks:: Bool )
560
565
num_frames = length (trace)
561
566
ndigits_max = ndigits (num_frames)
684
689
# Print a stack frame where the module color is set manually with `modulecolor`.
685
690
function print_stackframe (io, i, frame:: StackFrame , n:: Int , digit_align_width, modulecolor)
686
691
file, line = string (frame. file), frame. line
692
+ file = fixup_stdlib_path (file)
687
693
stacktrace_expand_basepaths () && (file = something (find_source_file (file), file))
688
694
stacktrace_contract_userdir () && (file = contractuser (file))
689
695
0 commit comments