Skip to content

Commit feb4e24

Browse files
committed
update help support for JuliaLang/julia#11943
1 parent 4e3ff80 commit feb4e24

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

src/PyCall.jl

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export pycall, pyimport, pybuiltin, PyObject,
1010
import Base: size, ndims, similar, copy, getindex, setindex!, stride,
1111
convert, pointer, summary, convert, show, haskey, keys, values,
1212
eltype, get, delete!, empty!, length, isempty, start, done,
13-
next, filter!, hash, splice!, pop!, ==, isequal, help, push!,
13+
next, filter!, hash, splice!, pop!, ==, isequal, push!,
1414
unshift!, shift!, append!, insert!, prepend!, writemime, mimewritable
1515

1616
# Python C API is not interrupt-save. In principle, we should
@@ -156,8 +156,17 @@ function show(io::IO, o::PyObject)
156156
print(io, "PyObject $(pystring(o))")
157157
end
158158

159-
function help(o::PyObject)
160-
pycall(pybuiltin("help"), PyAny, o)
159+
160+
if VERSION < v"0.4.0-dev+6471"
161+
function Base.help(o::PyObject)
162+
pycall(pybuiltin("help"), PyAny, o)
163+
end
164+
else
165+
function Base.Docs.doc(o::PyObject)
166+
Base.Docs.Text(haskey(o, "__doc__") ?
167+
convert(AbstractString, o["__doc__"]) :
168+
"Python object (no docstring found)")
169+
end
161170
end
162171

163172
#########################################################################

0 commit comments

Comments
 (0)