Skip to content

Commit 2c780f9

Browse files
authored
Merge pull request #78 from kngwyu/default-py3
Compile for python3 by default
2 parents dad4d9a + cbe7a56 commit 2c780f9

File tree

3 files changed

+6
-38
lines changed

3 files changed

+6
-38
lines changed

README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ Supported python version
3030
-------------
3131
Currently 2.7, 3.5, 3.6, 3.7 are supported.
3232

33-
By default, python version is automatically by execute `python`.
33+
By default, rust-numpy is built for Python3.
3434

35-
You cal also specify python version manually, by adding a feature flag like
35+
If you want to compile for Python2, please specify
3636

3737
``` toml
3838
[dependencies.numpy]
@@ -41,7 +41,8 @@ features = ["python3"]
4141
```
4242
.
4343

44-
You can also specify python version in [setup.py](examples/simple-extension/setup.py).
44+
You can also automatically specify python version in [setup.py](examples/simple-extension/setup.py)
45+
, using [setuptools-rust](https://github.com/PyO3/setuptools-rust).
4546

4647

4748
Example

build.rs

Lines changed: 0 additions & 33 deletions
This file was deleted.

src/npyffi/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@ use std::os::raw::c_void;
1616
fn get_numpy_api(module: &str, capsule: &str) -> *const *const c_void {
1717
let module = CString::new(module).unwrap();
1818
let capsule = CString::new(capsule).unwrap();
19-
#[cfg(not(Py_3))]
19+
#[cfg(feature = "python2")]
2020
unsafe fn get_capsule(capsule: *mut ffi::PyObject) -> *const *const c_void {
2121
ffi::PyCObject_AsVoidPtr(capsule) as *const *const c_void
2222
}
23-
#[cfg(Py_3)]
23+
#[cfg(not(feature = "python2"))]
2424
unsafe fn get_capsule(capsule: *mut ffi::PyObject) -> *const *const c_void {
2525
use std::ptr::null_mut;
2626
ffi::PyCapsule_GetPointer(capsule, null_mut()) as *const *const c_void

0 commit comments

Comments
 (0)