mirror of
https://github.com/boostorg/python.git
synced 2026-01-23 05:42:30 +00:00
Fix dict bug
[SVN r16866]
This commit is contained in:
@@ -65,8 +65,8 @@ object dict_base::get(object_cref k) const
|
||||
{
|
||||
if (check_exact(this))
|
||||
{
|
||||
return object(detail::borrowed_reference(
|
||||
PyDict_GetItem(this->ptr(),k.ptr())));
|
||||
PyObject* result = PyDict_GetItem(this->ptr(),k.ptr());
|
||||
return object(detail::borrowed_reference(result ? result : Py_None));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -61,6 +61,7 @@ void test_templates(object print)
|
||||
//print(tmp[1]);
|
||||
tmp[1.5] = 13;
|
||||
print(tmp.get(1.5));
|
||||
print(tmp.get(44));
|
||||
print(tmp);
|
||||
print(tmp.get(2,"default"));
|
||||
print(tmp.has_key(key));
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
>>> test_templates(printer)
|
||||
a test string
|
||||
13
|
||||
None
|
||||
{1.5: 13, 1: 'a test string'}
|
||||
default
|
||||
0
|
||||
|
||||
Reference in New Issue
Block a user