Remove dead code

This commit is contained in:
Daniel Grunwald 2015-04-18 22:25:03 +02:00
parent 5a303789b9
commit 5d3d03bcac
8 changed files with 2 additions and 35 deletions

View File

@ -1,4 +1,3 @@
use libc::c_char;
use std;
use ffi;
use python::{Python, PythonObject, PythonObjectWithCheckedDowncast, ToPythonPointer};

View File

@ -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<()> {

View File

@ -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.
//!

View File

@ -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<O>(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)'.

View File

@ -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!()
}
}

View File

@ -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();

View File

@ -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;

View File

@ -1,5 +1,4 @@
use std::sync::{Once, ONCE_INIT};
use std::thread::Thread;
use ffi;
use python::Python;