disable set

This commit is contained in:
Nikolay Kim 2017-05-25 08:08:40 -07:00
parent 0979653b98
commit 48329a793d
2 changed files with 10 additions and 8 deletions

View File

@ -13,7 +13,7 @@ pub use self::list::PyList;
pub use self::num::{PyLong, PyFloat};
//pub use self::sequence::PySequence;
pub use self::slice::PySlice;
pub use self::set::{PySet, PyFrozenSet};
//pub use self::set::{PySet, PyFrozenSet};
#[macro_export]
@ -93,6 +93,6 @@ mod list;
mod num;
//mod sequence;
mod slice;
mod set;
// mod set;
mod object;
pub mod exc;

View File

@ -1,17 +1,19 @@
// Copyright (c) 2017-present PyO3 Project and Contributors
//
use std::{hash, collections};
use ffi;
use python::{Python, PythonObject};
use pyptr::Py;
use python::Python;
use conversion::ToPyObject;
use objects::{PyObject, PyIterator};
use objects::PyObject; //, PyIterator};
use err::{self, PyResult, PyErr};
/// Represents a Python `set`
pub struct PySet(PyObject);
pub struct PySet;
/// Represents a Python `frozenset`
pub struct PyFrozenSet(PyObject);
pub struct PyFrozenSet;
pyobject_newtype!(PySet, PySet_Check, PySet_Type);
pyobject_newtype!(PyFrozenSet, PyFrozenSet_Check, PyFrozenSet_Type);
@ -85,7 +87,7 @@ impl PySet {
impl<T> ToPyObject for collections::HashSet<T>
where T: hash::Hash + Eq + ToPyObject
{
fn to_py_object(&self, py: Python) -> PyObject {
fn to_object<'p>(&self, py: Python<'p>) -> Py<'p, PyObject> {
let set = PySet::new::<T>(py, &[]);
for val in self {
set.add(py, val).unwrap();
@ -97,7 +99,7 @@ impl<T> ToPyObject for collections::HashSet<T>
impl<T> ToPyObject for collections::BTreeSet<T>
where T: hash::Hash + Eq + ToPyObject
{
fn to_py_object(&self, py: Python) -> PyObject {
fn to_object<'p>(&self, py: Python<'p>) -> Py<'p, PyObject> {
let set = PySet::new::<T>(py, &[]);
for val in self {
set.add(py, val).unwrap();