Skip to content

Commit

Permalink
propertynames for PyNULL (JuliaPy#707)
Browse files Browse the repository at this point in the history
  • Loading branch information
wookay authored and stevengj committed Aug 14, 2019
1 parent cf01bf0 commit 6dcf5c2
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
3 changes: 1 addition & 2 deletions src/PyCall.jl
Original file line number Diff line number Diff line change
Expand Up @@ -305,8 +305,7 @@ end

getproperty(o::PyObject, s::Symbol) = convert(PyAny, getproperty(o, String(s)))

propertynames(o::PyObject) = map(x->Symbol(first(x)),
pycall(inspect."getmembers", PyObject, o))
propertynames(o::PyObject) = ispynull(o) ? Symbol[] : map(x->Symbol(first(x)), pycall(inspect."getmembers", PyObject, o))

# avoiding method ambiguity
setproperty!(o::PyObject, s::Symbol, v) = _setproperty!(o,s,v)
Expand Down
1 change: 1 addition & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,7 @@ const PyInt = pyversion < v"3" ? Int : Clonglong
@test ispynull(PyNULL())
@test !ispynull(PyObject(3))
@test ispynull(pydecref(PyObject(3)))
@test isempty(propertynames(PyNULL()))

ex = try
pyimport("s p a m")
Expand Down

0 comments on commit 6dcf5c2

Please sign in to comment.