Sha256: 5b3aff68c9b44ece9d5964ea0b119e0ca49bb2875d2e52ba682d622ffb117c30

Contents?: true

Size: 372 Bytes

Versions: 1

Compression:

Stored size: 372 Bytes

Contents

require 'pycall'

module PyCall
  @exceptions = {
    Exception => LibPython.PyExc_RuntimeError,
    TypeError => LibPython.PyExc_TypeError,
  }.freeze

  def self.raise_python_exception(exception)
    pyexc = @exceptions[exception.class] || @exceptions[Exception]
    LibPython.PyErr_SetString(pyexc, "Ruby exception: #{exception.class}: #{exception.message}")
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
pycall-0.1.0.alpha.20170711 lib/pycall/exception.rb