lib/pycall/pyobject.rb in pycall-0.1.0.alpha.20170224 vs lib/pycall/pyobject.rb in pycall-0.1.0.alpha.20170226

- old
+ new

@@ -37,11 +37,11 @@ to_ptr == LibPython.Py_None.to_ptr end def kind_of?(klass) case klass - when PyTypeObject + when PyObject, PyTypeObject Types.pyisinstance(self, klass) else super end end @@ -120,10 +120,19 @@ super end end def to_s - PyCall.str(self) + s = LibPython.PyObject_Repr(self) + if s.null? + LibPython.PyErr_Clear() + s = LibPython.PyObject_Str(self) + if s.null? + LibPython.PyErr_Clear() + return super + end + end + s.to_ruby end alias inspect to_s end