Make ToPyObject
impl for HashSet
accept non-default hashers.
This commit is contained in:
parent
11f1a1d6f0
commit
43fca5dad7
|
@ -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.
|
- 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)
|
[#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 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. [#1702](https://github.com/PyO3/pyo3/pull/1702)
|
||||||
|
|
||||||
### Removed
|
### Removed
|
||||||
|
|
||||||
|
|
|
@ -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
|
where
|
||||||
T: hash::Hash + Eq + ToPyObject,
|
T: hash::Hash + Eq + ToPyObject,
|
||||||
|
S: hash::BuildHasher + Default,
|
||||||
{
|
{
|
||||||
fn to_object(&self, py: Python) -> PyObject {
|
fn to_object(&self, py: Python) -> PyObject {
|
||||||
let set = PySet::new::<T>(py, &[]).expect("Failed to construct empty set");
|
let set = PySet::new::<T>(py, &[]).expect("Failed to construct empty set");
|
||||||
|
|
Loading…
Reference in a new issue