JuliaWeb / Gumbo.jl

Julia wrapper around Google's gumbo C library for parsing HTML
Other
154 stars 25 forks source link

“TypeError: in Tuple, in parameter, expected Type, got HTMLText” when iterating on 0.7.0-beta2.0 #53

Closed ghost closed 6 years ago

ghost commented 6 years ago

The following simple example runs fine using Julia 0.6.4.

using AbstractTrees
using Gumbo

for el in PreOrderDFS(parsehtml("""
        <h1>
            Foo
        </h1>
        """))
    @show el
end

However, on Julia 0.7.0-beta2.0 it goes down in flames.

ERROR: LoadError: TypeError: in Tuple, in parameter, expected Type, got HTMLText
Stacktrace:
 [1] has_non_default_iterate(::HTMLText) at ./essentials.jl:833
 [2] isiterable(::HTMLText) at ./essentials.jl:864
 [3] children at ~/.julia/packages/AbstractTrees/gbHm/src/AbstractTrees.jl:26 [inlined]
 [4] children at ~/.julia/packages/AbstractTrees/gbHm/src/traits.jl:36 [inlined]
 [5] children at ~/.julia/packages/AbstractTrees/gbHm/src/traits.jl:38 [inlined]
 [6] childstates at ~/.julia/packages/AbstractTrees/gbHm/src/AbstractTrees.jl:333 [inlined]
 [7] childstates(::HTMLElement{:HTML}, ::HTMLText) at ~/.julia/packages/AbstractTrees/gbHm/src/implicitstacks.jl:35
 [8] childstates(::AbstractTrees.ImplicitChildStates{HTMLElement{:HTML},AbstractTrees.ImplicitNodeStack{Any,Int64}}) at ~/.julia/packages/AbstractTrees/gbHm/src/implicitstacks.jl:41
 [9] iterate(::AbstractTrees.ImplicitChildStates{HTMLElement{:HTML},AbstractTrees.ImplicitNodeStack{Any,Int64}}, ::Int64) at ~/.julia/packages/AbstractTrees/gbHm/src/implicitstacks.jl:46 (repeats 2 times)
 [10] isempty at ./essentials.jl:721 [inlined]
 [11] stepstate(::PreOrderDFS{HTMLElement{:HTML}}, ::AbstractTrees.ImplicitNodeStack{Any,Int64}) at ~/.julia/packages/AbstractTrees/gbHm/src/AbstractTrees.jl:446
 [12] iterate(::PreOrderDFS{HTMLElement{:HTML}}, ::AbstractTrees.ImplicitNodeStack{Any,Int64}) at ~/.julia/packages/AbstractTrees/gbHm/src/AbstractTrees.jl:468
 [13] top-level scope at gumbobug.jl:9 [inlined]
 [14] top-level scope at ./<missing>:0
 [15] include at ./boot.jl:317 [inlined]
 [16] include_relative(::Module, ::String) at ./loading.jl:1034
 [17] include(::Module, ::String) at ./sysimg.jl:29
 [18] exec_options(::Base.JLOptions) at ./client.jl:234
 [19] _start() at ./client.jl:427
in expression starting at gumbobug.jl:4

I am sure this is due to some changes that came with 0.7, but I am still working on catching up with the release so I am not entirely sure what is going wrong.

porterjamesj commented 6 years ago

Hi @ninjin, Gumbo doesn't support 0.7 yet, so this is not at all surprising, probably almost nothing will work. You can track progress on 0.7 support in https://github.com/JuliaWeb/Gumbo.jl/pull/52!

ghost commented 6 years ago

Thanks @porterjamesj, apologies for missing the PR, only checked the issues and saw nothing about 0.7.