Fix python 3 build on windows.

This commit is contained in:
Daniel Grunwald 2015-06-28 18:55:20 +02:00
parent 76e38e1a54
commit cdca6f04e8
2 changed files with 9 additions and 1 deletions

View File

@ -93,6 +93,14 @@ pub use objectprotocol::{ObjectProtocol};
pub use rustobject::{PyRustType, PyRustObject};
pub use rustobject::typebuilder::PyRustTypeBuilder;
#[cfg(feature="python27-sys")]
#[allow(non_camel_case_types)]
pub type Py_hash_t = libc::c_long;
#[cfg(feature="python3-sys")]
#[allow(non_camel_case_types)]
pub type Py_hash_t = ffi::Py_hash_t;
use std::ptr;
/// Constructs a `&'static CStr` literal.

View File

@ -149,7 +149,7 @@ pub trait ObjectProtocol<'p> : PythonObject<'p> {
/// Retrieves the hash code of the object.
/// This is equivalent to the Python expression: 'hash(self)'
#[inline]
fn hash(&self) -> PyResult<'p, libc::c_long> {
fn hash(&self) -> PyResult<'p, ::Py_hash_t> {
let v = unsafe { ffi::PyObject_Hash(self.as_ptr()) };
if v == -1 {
Err(PyErr::fetch(self.python()))