Closed MilesCranmer closed 7 months ago
It's worth noting that Meta.parseall
is undocumented, but this still looks like a good fix to me.
I suppose it would be possible to do this with public API by repeatedly parsing with the two-arg parse method and then manually joining them into a single expr, but I like this approach better.
Is it public since it is parseall
rather than _parseall
? (I don't know; just wondering). There are even some exported functions from Julia that don't have docs IIRC.
Just for posterity: I just tried to do a 2-arg Meta.parse version and ran into some sharp edges of the interface. For this reason I think parseall
is safer even if not documented given it's unit-tested in Base and calls the same underlying _parse_str
but with a different option.
Great thanks! Given Meta.parseall
is used directly for code loading it seems unlikely to go away. Would be good to get it documented in Julia though, since there's no other documented reliable way to parse top-level expressions.
Simpler than I thought!
Fixes https://github.com/JuliaPy/PythonCall.jl/issues/433
@LilithHafner @cjdoris
The only difference between these is that
Meta.parse
checks for multiple blocks and throws an error:whereas
Meta.parseall
ignores the number of blocks:Note that otherwise the behavior is identical.