lib/pycall/dict.rb in pycall-0.1.0.alpha.20170224 vs lib/pycall/dict.rb in pycall-0.1.0.alpha.20170226
- old
+ new
@@ -66,10 +66,13 @@
def values
LibPython.PyDict_Values(__pyobj__).to_ruby
end
def has_key?(key)
- 1 == LibPython.PyDict_Contains(__pyobj__, key).to_ruby
+ key = Conversions.from_ruby(key)
+ value = LibPython.PyDict_Contains(__pyobj__, key)
+ raise PyError.fetch if value == -1
+ 1 == value
end
def default=(val)
# TODO: PYDict_SetDefault
end