Merge pull request #317 from PyO3/issue_313

Fix #313
This commit is contained in:
konstin 2019-01-08 19:39:25 +01:00 committed by GitHub
commit 146cb31c59
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 3 deletions

View File

@ -223,14 +223,14 @@ where
impl<K, V, H> IntoPyObject for collections::HashMap<K, V, H>
where
K: hash::Hash + cmp::Eq + ToPyObject,
V: ToPyObject,
K: hash::Hash + cmp::Eq + IntoPyObject,
V: IntoPyObject,
H: hash::BuildHasher,
{
fn into_object(self, py: Python) -> PyObject {
let dict = PyDict::new(py);
for (key, value) in self {
dict.set_item(key, value)
dict.set_item(key.into_object(py), value.into_object(py))
.expect("Failed to set_item on dict");
}
dict.into()