class PyBind::PyError
Attributes
traceback[R]
type[R]
value[R]
Public Class Methods
fetch()
click to toggle source
# File lib/pybind/error.rb, line 3 def self.fetch ptrs = FFI::MemoryPointer.new(:pointer, 3) ptype = ptrs + 0 * ptrs.type_size pvalue = ptrs + 1 * ptrs.type_size ptraceback = ptrs + 2 * ptrs.type_size LibPython.PyErr_Fetch(ptype, pvalue, ptraceback) LibPython.PyErr_NormalizeException(ptype, pvalue, ptraceback) type = TypeCast.from_python(PyObjectStruct.new(ptype.read(:pointer))) value = TypeCast.from_python(PyObjectStruct.new(pvalue.read(:pointer))) traceback = TypeCast.from_python(PyObjectStruct.new(ptraceback.read(:pointer))) new(type, value, traceback) end
new(type, value, traceback)
click to toggle source
Calls superclass method
# File lib/pybind/error.rb, line 16 def initialize(type, value, traceback) @type = type @value = value @traceback = traceback super("#{type}: #{value}") end
Public Instance Methods
message()
click to toggle source
Calls superclass method
# File lib/pybind/error.rb, line 25 def message baseline = super lines = [baseline] + PyBind.parse_traceback(traceback) lines.join("\n") rescue baseline end