-
-
Notifications
You must be signed in to change notification settings - Fork 90
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
@df: Passing column name as string overflows stack #562
Comments
ron-wolf
changed the title
StackOverflowError when
@df: Passing column name as string overflows stack
Oct 23, 2024
ron-wolf
added a commit
to ron-wolf/StatsPlots.jl
that referenced
this issue
Oct 24, 2024
Fixes JuliaPlots#562. Add a special case to `add_sym!` to convert an `AbstractString` column name to a `Symbol` before adding it. The old behavior would iterate over the string and try to add each character as a column name. This produced a stack overflow, since `add_sym!` had no special case for `Char`, resulting in indefinite recursion.
7 tasks
Issue resolved by JuliaPlots/Plots.jl#5033. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I was trying to plot this CSV dataset using
StatsPlots.@df
. I wrote and ran the following code in a fresh Pluto notebook:I expected this to work, as per the
README
, but I was instead greeted by aStackOverflowError
. Running again line-by-line in the Julia REPL yielded this stack trace:However, this isn't the whole story, as expanding the macro by itself with
macroexpand
yields the following code (cleaned up):And sure enough, attempting to call that first function
extract_columns_and_names
with those arguments yields the same error. The culprit is the following line of code in that function:StatsPlots.jl/src/df.jl
Line 222 in bb65b7c
Which delegates to
add_sym!
, which recurses indefinitely over the first character of the first string, as follows:The solution is to special-case strings in the definition for
add_sym!
, making sure not to iterate over their characters individually, but instead to convert them to symbols first.The text was updated successfully, but these errors were encountered: