Skip to content

Commit 37bc5f9

Browse files
author
Christopher Doris
committed
allow module/name to be missing from types
1 parent 24556e1 commit 37bc5f9

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/convert.jl

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,11 @@ pyconvert_tryconvert(::Type{T}, x) where {T} =
8282
pyconvert_unconverted()
8383
end
8484

85+
function pyconvert_typename(t::Py)
86+
m = pygetattr(t, "__module__", "<unknown>")
87+
n = pygetattr(t, "__name__", "<name>")
88+
return "$m/$n"
89+
end
8590

8691
function pyconvert_get_rules(type::Type, pytype::Py)
8792
@nospecialize type
@@ -142,7 +147,7 @@ function pyconvert_get_rules(type::Type, pytype::Py)
142147
@assert all(pyis(x,y) for (x,y) in zip(omro, omro_))
143148

144149
# get the names of the types in the MRO of pytype
145-
xmro = [["$(t.__module__)/$(t.__qualname__)"] for t in mro]
150+
xmro = [String[pyconvert_typename(t)] for t in mro]
146151

147152
# add special names corresponding to certain interfaces
148153
# these get inserted just above the topmost type satisfying the interface

0 commit comments

Comments
 (0)