Sha256: 02c40bccd0cd8df7eac2448e011a0945740bc108df7be79e552f6ac7e0316421

Contents?: true

Size: 556 Bytes

Versions: 4

Compression:

Stored size: 556 Bytes

Contents

module PyCall
  private_class_method def self.__initialize_pycall__
    initialized = (0 != PyCall::LibPython.Py_IsInitialized())
    return if initialized

    PyCall::LibPython.Py_InitializeEx(0)

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

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

  class << self
    attr_reader :builtin
  end

  __initialize_pycall__
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
pycall-0.1.0.alpha.20170419b lib/pycall/init.rb
pycall-0.1.0.alpha.20170419a lib/pycall/init.rb
pycall-0.1.0.alpha.20170419 lib/pycall/init.rb
pycall-0.1.0.alpha.20170403 lib/pycall/init.rb