Skip to content

Incorrect line number for kwarg function call in stack trace #45171

Closed
@BioTurboNick

Description

@BioTurboNick
using DataFrames

a = [1, 2, 3]
b = [3, 4]
c() = DataFrame(:a => a, :b => b)
c()

#=
ERROR: DimensionMismatch: column :a has length 3 and column :b has length 2
Stacktrace:
 [1] DataFrame(columns::Vector{Any}, colindex::DataFrames.Index; copycols::Bool)
   @ DataFrames C:\Users\nicho\.julia\packages\DataFrames\zqFGs\src\dataframe\dataframe.jl:192
 [2] DataFrame(::Pair{Symbol, Vector{Int64}}, ::Vararg{Pair{Symbol, Vector{Int64}}}; makeunique::Bool, copycols::Bool)
   @ DataFrames C:\Users\nicho\.julia\packages\DataFrames\zqFGs\src\dataframe\dataframe.jl:247
 [3] DataFrame(::Pair{Symbol, Vector{Int64}}, ::Vararg{Pair{Symbol, Vector{Int64}}})
   @ DataFrames C:\Users\nicho\.julia\packages\DataFrames\zqFGs\src\dataframe\dataframe.jl:245
 [4] c()
   @ Main .\REPL[4]:1
 [5] top-level scope
   @ REPL[5]:1
=#

image

image

The screenshot is from C:\Users\nicho.julia\packages\DataFrames\zqFGs\src\dataframe\dataframe.jl

Line 192 is where the error is thrown. Line 247 is the call site of the function that threw the error. Is Line 245 is supposed to be Line 243?

Another example, where the line number is only 1 off:

function aa()
       1
       2
       3
       error(3)
end

 function bb()
       3
       4
       aa()
end

function cc(;kwarg = true)
       1
       bb()
end

cc()

#=
ERROR: 3
Stacktrace:
 [1] error(s::Int64)
   @ Base .\error.jl:42
 [2] aa()
   @ Main .\REPL[1]:5
 [3] bb()
   @ Main .\REPL[2]:4
 [4] cc(; kwarg::Bool)
   @ Main .\REPL[3]:3
 [5] cc()
   @ Main .\REPL[3]:2
 [6] top-level scope
   @ REPL[4]:1
=#

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions