diff --git a/src/exception.jl b/src/exception.jl index 7df89269..362719ed 100644 --- a/src/exception.jl +++ b/src/exception.jl @@ -140,7 +140,7 @@ end ######################################################################### # Mapping of Julia Exception types to Python exceptions -const pyexc = Dict{DataType, PyPtr}() +const pyexc = IdDict{DataType, PyPtr}() mutable struct PyIOError <: Exception end function pyexc_initialize() @@ -213,7 +213,7 @@ end function pyraise(e, bt = nothing) eT = typeof(e) - pyeT = haskey(pyexc::Dict, eT) ? pyexc[eT] : pyexc[Exception] + pyeT = haskey(pyexc, eT) ? pyexc[eT] : pyexc[Exception] err = PyJlError(e, bt) ccall((@pysym :PyErr_SetObject), Cvoid, (PyPtr, PyPtr), pyeT, PyObject(err)) diff --git a/src/io.jl b/src/io.jl index 145b2fea..bee8440f 100644 --- a/src/io.jl +++ b/src/io.jl @@ -11,7 +11,7 @@ function ioraise(e, bt = nothing) if isa(e, MethodError) || isa(e, ErrorException) ccall((@pysym :PyErr_SetString), Cvoid, (PyPtr, Cstring), - (pyexc::Dict)[PyIOError], + pyexc[PyIOError], showerror_string(e, bt)) else pyraise(e, bt)