Skip to content

Commit

Permalink
Make ToPyObject impl for HashSet accept non-default hashers.
Browse files Browse the repository at this point in the history
  • Loading branch information
ohadravid committed Jun 27, 2021
1 parent 11f1a1d commit 02e9e75
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Use `METH_FASTCALL` argument passing convention, when possible, to improve `#[pyfunction]` and method performance.
[#1619](/~https://github.com/PyO3/pyo3/pull/1619), [#1660](/~https://github.com/PyO3/pyo3/pull/1660)
- Make the `Py_tracefunc` parameter of the `PyEval_SetProfile`/`PyEval_SetTrace` functions optional. [#1692](/~https://github.com/PyO3/pyo3/pull/1692)
- Make `ToPyObject` impl for `HashSet` accept non-default hashers. [#XX](/~https://github.com/PyO3/pyo3/pull/XX)

### Removed

Expand Down
3 changes: 2 additions & 1 deletion src/types/set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -183,9 +183,10 @@ impl<'a> std::iter::IntoIterator for &'a PySet {
}
}

impl<T> ToPyObject for collections::HashSet<T>
impl<T, S> ToPyObject for collections::HashSet<T, S>
where
T: hash::Hash + Eq + ToPyObject,
S: hash::BuildHasher + Default,
{
fn to_object(&self, py: Python) -> PyObject {
let set = PySet::new::<T>(py, &[]).expect("Failed to construct empty set");
Expand Down

0 comments on commit 02e9e75

Please sign in to comment.