Fix python 3 build on windows.
This commit is contained in:
parent
76e38e1a54
commit
cdca6f04e8
|
@ -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.
|
||||
|
|
|
@ -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()))
|
||||
|
|
Loading…
Reference in New Issue