Merge pull request #564 from kngwyu/paste

Replace mashup with paste
This commit is contained in:
Yuji Kanagawa 2019-08-11 18:42:21 +09:00 committed by GitHub
commit 1f85593d0a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 16 additions and 27 deletions

View file

@ -21,7 +21,7 @@ matrix:
- name: Minimum nightly
python: "3.7"
# Keep this synced up with build.rs
env: TRAVIS_RUST_VERSION=nightly-2019-06-22
env: TRAVIS_RUST_VERSION=nightly-2019-07-19
# Tested via anaconda PyPy (since travis's PyPy version is too old)
- name: PyPy3.5 7.0
python: "3.7"

View file

@ -26,6 +26,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
* Implementing the Using the `gc` parameter for `pyclass` (e.g. `#[pyclass(gc)]`) without implementing the `class::PyGCProtocol` trait is now a compile-time error. Failing to implement this trait could lead to segfaults. [#532](https://github.com/PyO3/pyo3/pull/532)
* `PyByteArray::data` has been replaced with `PyDataArray::to_vec` because returning a `&[u8]` is unsound. (See [this comment](https://github.com/PyO3/pyo3/issues/373#issuecomment-512332696) for a great write-up for why that was unsound)
* Replace `mashup` with `paste`.
## [0.7.0] - 2018-05-26

View file

@ -23,11 +23,11 @@ libc = "0.2.54"
spin = "0.5.0"
num-traits = "0.2.6"
pyo3cls = { path = "pyo3cls", version = "=0.7.0" }
mashup = "0.1.9"
num-complex = { version = "0.2.1", optional = true }
inventory = "0.1.3"
indoc = "0.3.3"
unindent = "0.1.3"
paste = "0.1.5"
[dev-dependencies]
assert_approx_eq = "1.1.0"

View file

@ -16,7 +16,7 @@ A comparison with rust-cpython can be found [in the guide](https://pyo3.rs/maste
## Usage
PyO3 supports Python 3.5 and up. The minimum required Rust version is 1.34.0-nightly 2019-02-06.
PyO3 supports Python 3.5 and up. The minimum required Rust version is 1.37.0-nightly 2019-07-19.
PyPy is also supported (via cpyext) for Python 3.5 only, targeted PyPy version is 7.0.0.
Please refer to the guide for installation instruction against PyPy.

View file

@ -16,7 +16,7 @@ use version_check::{Channel, Date, Version};
/// Specifies the minimum nightly version needed to compile pyo3.
/// Keep this synced up with the travis ci config,
/// But note that this is the rustc version which can be lower than the nightly version
const MIN_DATE: &'static str = "2019-06-21";
const MIN_DATE: &'static str = "2019-07-18";
const MIN_VERSION: &'static str = "1.37.0-nightly";
/// Information returned from python interpreter

View file

@ -10,7 +10,7 @@ A comparison with rust-cpython can be found [in the guide](https://pyo3.rs/maste
## Usage
PyO3 supports Python 3.5 and up. The minimum required Rust version is 1.34.0-nightly 2019-02-06.
PyO3 supports Python 3.5 and up. The minimum required Rust version is 1.37.0-nightly 2019-07-19.
PyPy is also supported (via cpyext) for Python 3.5 only, targeted PyPy version is 7.0.0.
Please refer to the guide for installation instruction against PyPy.

24
src/lib.rs Normal file → Executable file
View file

@ -132,7 +132,7 @@ pub use crate::type_object::{PyObjectAlloc, PyRawObject, PyTypeInfo};
// Re-exported for wrap_function
#[doc(hidden)]
pub use mashup;
pub use paste;
// Re-exported for py_run
#[doc(hidden)]
pub use indoc;
@ -184,17 +184,7 @@ pub mod proc_macro {
#[macro_export]
macro_rules! wrap_pyfunction {
($function_name: ident) => {{
// Get the mashup macro and its helpers into scope
use pyo3::mashup::*;
mashup! {
// Make sure this ident matches the one in function_wrapper_ident
m["method"] = __pyo3_get_function_ $function_name;
}
m! {
&"method"
}
&pyo3::paste::expr! { [<__pyo3_get_function_ $function_name>] }
}};
}
@ -204,14 +194,8 @@ macro_rules! wrap_pyfunction {
#[macro_export]
macro_rules! wrap_pymodule {
($module_name:ident) => {{
use pyo3::mashup::*;
mashup! {
m["method"] = PyInit_ $module_name;
}
m! {
&|py| unsafe { pyo3::PyObject::from_owned_ptr(py, "method"()) }
pyo3::paste::expr! {
&|py| unsafe { pyo3::PyObject::from_owned_ptr(py, [<PyInit_ $module_name>]()) }
}
}};
}

View file

@ -3,3 +3,5 @@ error: #[pyclass] cannot have generic parameters
|
4 | struct ClassWithGenerics<A> {
| ^^^
error: Could not compile `pyo3-tests`.

View file

@ -3,3 +3,5 @@ error: Getter function can only have one argument of type pyo3::Python!
|
11 | fn get_num(&self, index: u32) {}
| ^^^
error: Could not compile `pyo3-tests`.