JuliaPy / JuliaPy/PyCall.jl

zero-arg call to Python `super()` not working

Abierto
#409 7 comentarios 0 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
Julia
Estrellas
1.5k
Forks
186
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

As the title says, the zero-arg version of `super()` doesn't work,

```julia
julia> @pydef type Foo
__str__(self) = pybuiltin(:super)()[:__str__]()
end
PyObject

julia> Foo()[:__str__]()
ERROR: PyError (ccall(@pysym(:PyObject_Call), PyPtr, (PyPtr, PyPtr, PyPtr), o, arg, C_NULL))
RuntimeError('super(): no arguments',)
File "PyCall", line 1, in

Stacktrace:
[1] pyerr_check at /home/marius/.julia/v0.6/PyCall/src/exception.jl:56 [inlined]
[2] pyerr_check at /home/marius/.julia/v0.6/PyCall/src/exception.jl:61 [inlined]
[3] macro expansion at /home/marius/.julia/v0.6/PyCall/src/exception.jl:81 [inlined]
[4] #_pycall#66(::Array{Any,1}, ::Function, ::PyCall.PyObject) at /home/marius/.julia/v0.6/PyCall/src/PyCall.jl:620
[5] #pycall#70(::Array{Any,1}, ::Function, ::PyCall.PyObject, ::Type{PyCall.PyAny}) at /home/marius/.julia/v0.6/PyCall/src/PyCall.jl:642
[6] #call#71 at /home/marius/.julia/v0.6/PyCall/src/PyCall.jl:645 [inlined]
[7] (::PyCall.PyObject)() at /home/marius/.julia/v0.6/PyCall/src/PyCall.jl:645
```

although the manual version is fine,

```julia
julia> @pydef type Bar
__str__(self) = pybuiltin(:super)(Bar,self)[:__str__]()
end
PyObject

julia> Bar()[:__str__]()
""
```

I'm guessing what's happening is described by [this](https://stackoverflow.com/a/39313448/1078529) answer,

> The zero-argument form of super requires that the method containing it have an explicit (i.e., non-varargs) first argument

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.