diff --git a/src/conversion.rs b/src/conversion.rs index ebf661bf..1f4bf4e4 100644 --- a/src/conversion.rs +++ b/src/conversion.rs @@ -1,4 +1,3 @@ -use libc::c_char; use std; use ffi; use python::{Python, PythonObject, PythonObjectWithCheckedDowncast, ToPythonPointer}; diff --git a/src/err.rs b/src/err.rs index 6fa3a9a0..d1b5e275 100644 --- a/src/err.rs +++ b/src/err.rs @@ -239,16 +239,6 @@ pub unsafe fn result_cast_from_owned_ptr<'p, T>(py : Python<'p>, p : *mut ffi::P } } -/// Returns Ok if the error code is 0. -#[inline] -pub fn error_on_nonzero(py : Python, result : libc::c_int) -> PyResult<()> { - if result == 0 { - Ok(()) - } else { - Err(PyErr::fetch(py)) - } -} - /// Returns Ok if the error code is not -1. #[inline] pub fn error_on_minusone(py : Python, result : libc::c_int) -> PyResult<()> { diff --git a/src/lib.rs b/src/lib.rs index 1002e3d2..0b0a5762 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -4,7 +4,7 @@ #![feature(optin_builtin_traits)] // for opting out of Sync/Send #![feature(slice_patterns)] // for tuple_conversion macros #![feature(utf8_error)] // for translating Utf8Error to python exception -#![allow(unused_imports, dead_code, unused_variables)] +#![allow(unused_imports, unused_variables)] //! Rust bindings to the python interpreter. //! diff --git a/src/objectprotocol.rs b/src/objectprotocol.rs index 92fdcd2f..06eaf851 100644 --- a/src/objectprotocol.rs +++ b/src/objectprotocol.rs @@ -9,12 +9,6 @@ use objects::{PyObject, PyTuple, PyDict}; use conversion::ToPyObject; use err::{PyErr, PyResult, result_from_owned_ptr, error_on_minusone}; -// Workaround because .as_ptr() doesn't work for associated types -#[inline] -fn as_ptr(obj: &O) -> *mut ffi::PyObject where O: ToPythonPointer { - obj.as_ptr() -} - pub trait ObjectProtocol<'p> : PythonObject<'p> { /// Determines whether this object has the given attribute. /// This is equivalent to the Python expression 'hasattr(self, attr_name)'. diff --git a/src/objects/dict.rs b/src/objects/dict.rs index 821be24d..84c8ae20 100644 --- a/src/objects/dict.rs +++ b/src/objects/dict.rs @@ -7,7 +7,7 @@ use err::{self, PyResult}; pyobject_newtype!(PyDict, PyDict_Check, PyDict_Type); impl <'p> PyDict<'p> { - fn new(py: Python<'p>) -> PyDict<'p> { + pub fn new(py: Python<'p>) -> PyDict<'p> { unimplemented!() } } diff --git a/src/objects/string.rs b/src/objects/string.rs index 8db0c21d..4489a14c 100644 --- a/src/objects/string.rs +++ b/src/objects/string.rs @@ -104,19 +104,6 @@ impl <'p, 's> FromPyObject<'p, 's> for String { } } -fn string_as_slice<'a, 'p>(s: &'a PyObject<'p>) -> PyResult<'p, &'a [u8]> { - unsafe { - let mut buffer : *mut c_char = std::mem::uninitialized(); - let mut length : ffi::Py_ssize_t = std::mem::uninitialized(); - if ffi::PyString_AsStringAndSize(s.as_ptr(), &mut buffer, &mut length) == 1 { - Err(PyErr::fetch(s.python())) - } else { - Ok(std::slice::from_raw_parts(buffer as *const u8, length as usize)) - } - } -} - - #[test] fn test_non_bmp() { let gil = Python::acquire_gil(); diff --git a/src/python.rs b/src/python.rs index 258f8601..4e4186d8 100644 --- a/src/python.rs +++ b/src/python.rs @@ -1,11 +1,9 @@ use std; use std::marker::PhantomData; -use std::ptr; use ffi; use objects::{PyObject, PyType, PyBool, PyModule}; use err::PyResult; use pythonrun::GILGuard; -use std::ffi::CStr; // Dummy struct representing the global state in the python interpreter. struct PythonInterpreterState; diff --git a/src/pythonrun.rs b/src/pythonrun.rs index e8b2144e..bcc41f48 100644 --- a/src/pythonrun.rs +++ b/src/pythonrun.rs @@ -1,5 +1,4 @@ use std::sync::{Once, ONCE_INIT}; -use std::thread::Thread; use ffi; use python::Python;