Skip to content

Commit

Permalink
Fixed scoping bug in pyobject_native_type that would break rust-numpy
Browse files Browse the repository at this point in the history
  • Loading branch information
konstin committed Jul 18, 2018
1 parent d59bebc commit 7d4381f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# Changelog

## 0.3.0 (unreleased)
## 0.3.1

* Fixed scoping bug in pyobject_native_type that would break rust-numpy

## 0.3.0

* Upgraded to syn 0.14 which means much better error messages :tada:
* 128 bit integer support by [kngwyu](https://github.com/kngwyu) ([#137](https://github.com/PyO3/pyo3/pull/173))
Expand Down
6 changes: 3 additions & 3 deletions src/objects/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ macro_rules! pyobject_downcast(
{
unsafe {
if $checkfunction(ob.as_ptr()) != 0 {
Ok(&*(ob as *const $crate::objects::PyObjectRef as *const $name))
Ok(&*(ob as *const $crate::PyObjectRef as *const $name))
} else {
Err($crate::PyDowncastError.into())
}
Expand All @@ -62,7 +62,7 @@ macro_rules! pyobject_native_type_named(
impl ::std::convert::AsRef<$crate::PyObjectRef> for $name {
#[cfg_attr(feature = "cargo-clippy", allow(useless_transmute))]
fn as_ref(&self) -> &$crate::PyObjectRef {
unsafe{&*(self as *const $name as *const $crate::objects::PyObjectRef)}
unsafe{&*(self as *const $name as *const $crate::PyObjectRef)}
}
}

Expand Down Expand Up @@ -99,7 +99,7 @@ macro_rules! pyobject_native_type(

impl<'a> ::std::convert::From<&'a $name> for &'a $crate::PyObjectRef {
fn from(ob: &'a $name) -> Self {
unsafe{&*(ob as *const $name as *const $crate::objects::PyObjectRef)}
unsafe{&*(ob as *const $name as *const $crate::PyObjectRef)}
}
}
};
Expand Down

0 comments on commit 7d4381f

Please sign in to comment.