lib/pycall/utils.rb in pycall-0.1.0.alpha.20170309 vs lib/pycall/utils.rb in pycall-0.1.0.alpha.20170311
- old
+ new
@@ -44,11 +44,18 @@
def None
LibPython.Py_None
end
def none?(pyobj)
- pyobj = pyobj.__pyobj__ unless pyobj.kind_of? LibPython::PyObjectStruct
- pyobj.to_ptr == self.None.to_ptr
+ case pyobj
+ when FFI::Pointer
+ ptr = pyobj
+ when LibPython::PyObjectStruct
+ ptr = pyobj.to_ptr
+ else
+ pyobj = pyobj.__pyobj__.to_ptr
+ end
+ ptr == self.None.to_ptr
end
def slice(*args)
Slice.new(*args)
end