lib/pycall/eval.rb in pycall-0.1.0.alpha.20170307 vs lib/pycall/eval.rb in pycall-0.1.0.alpha.20170308

- old
+ new

@@ -1,12 +1,12 @@ module PyCall module Eval Py_eval_input = 258 def self.eval(str, filename: "pycall") - globals_ptr = main_dict - locals_ptr = main_dict + globals_ptr = main_dict.__pyobj__ + locals_ptr = main_dict.__pyobj__ defer_sigint do py_code_ptr = LibPython.Py_CompileString(str, filename, Py_eval_input) raise PyError.fetch if py_code_ptr.null? LibPython.PyEval_EvalCode(py_code_ptr, globals_ptr, locals_ptr) end @@ -15,11 +15,11 @@ class << self private def main_dict @main_dict ||= PyCall.import_module("__main__") do |main_module| - PyCall.incref(LibPython.PyModule_GetDict(main_module)) + PyCall.incref(LibPython.PyModule_GetDict(main_module.__pyobj__)).to_ruby end end def defer_sigint # TODO: should be implemented @@ -36,10 +36,10 @@ value = value.to_ruby return value unless block_given? begin yield value ensure - PyCall.decref(value) + PyCall.decref(value.__pyobj__) end end def self.eval(str, conversion: true) result = Eval.eval(str)