Sha256: 69dec8e17ef8058342a83284c9687dcc33d82593a3cb88d6db475ac96115985d

Contents?: true

Size: 543 Bytes

Versions: 1

Compression:

Stored size: 543 Bytes

Contents

module PyBind
  private_class_method

  class << self
    attr_reader :builtin
  end

  def self.__initialize_pybind__
    initialized = (0 != LibPython.Py_IsInitialized())
    return if initialized

    LibPython.Py_InitializeEx(0)

    FFI::MemoryPointer.new(:pointer, 1) do |argv|
      argv.write_pointer(FFI::MemoryPointer.from_string(''))
      LibPython.PySys_SetArgvEx(0, argv, 0)
    end

    @builtin = LibPython.PyImport_ImportModule(PYTHON_VERSION < '3.0.0' ? '__builtin__' : 'builtins').to_ruby
  end

  __initialize_pybind__
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
pybind-0.1.0 lib/pybind/init.rb