various improvements
This commit is contained in:
parent
03ced8917b
commit
fdd9ac7ae9
|
@ -1,10 +1,17 @@
|
||||||
language: python
|
language: python
|
||||||
python:
|
python:
|
||||||
|
#- "2.7"
|
||||||
- "3.5"
|
- "3.5"
|
||||||
- "3.6"
|
- "3.6"
|
||||||
|
|
||||||
|
matrix:
|
||||||
|
allow_failures:
|
||||||
|
- python: "2.7"
|
||||||
|
|
||||||
env:
|
env:
|
||||||
# - RUST_VERSION=1.17.0
|
# - RUST_VERSION=1.17.0
|
||||||
- RUST_VERSION=nightly
|
- RUST_VERSION=nightly
|
||||||
|
|
||||||
sudo: required
|
sudo: required
|
||||||
dist: trusty
|
dist: trusty
|
||||||
install:
|
install:
|
||||||
|
|
|
@ -24,7 +24,6 @@ pub fn build_py3_module_init(ast: &mut syn::Item, attr: String) -> Tokens {
|
||||||
#[allow(non_upper_case_globals, unused_attributes,
|
#[allow(non_upper_case_globals, unused_attributes,
|
||||||
unused_qualifications, unused_variables, non_camel_case_types)]
|
unused_qualifications, unused_variables, non_camel_case_types)]
|
||||||
const #dummy_const: () = {
|
const #dummy_const: () = {
|
||||||
use std;
|
|
||||||
extern crate pyo3 as _pyo3;
|
extern crate pyo3 as _pyo3;
|
||||||
|
|
||||||
#tokens
|
#tokens
|
||||||
|
@ -92,7 +91,6 @@ pub fn build_py2_module_init(ast: &mut syn::Item, attr: String) -> Tokens {
|
||||||
#[allow(non_upper_case_globals, unused_attributes,
|
#[allow(non_upper_case_globals, unused_attributes,
|
||||||
unused_qualifications, unused_variables, non_camel_case_types)]
|
unused_qualifications, unused_variables, non_camel_case_types)]
|
||||||
const #dummy_const: () = {
|
const #dummy_const: () = {
|
||||||
use std;
|
|
||||||
extern crate pyo3 as _pyo3;
|
extern crate pyo3 as _pyo3;
|
||||||
|
|
||||||
#tokens
|
#tokens
|
||||||
|
|
|
@ -568,11 +568,11 @@ impl_element!(f64, Float);
|
||||||
mod test {
|
mod test {
|
||||||
use std;
|
use std;
|
||||||
use python::{Python};
|
use python::{Python};
|
||||||
//use conversion::ToPyObject;
|
|
||||||
//use objects::{PyList, PyTuple};//, PySequence, PyIterator};
|
|
||||||
use objectprotocol::ObjectProtocol;
|
|
||||||
use super::PyBuffer;
|
use super::PyBuffer;
|
||||||
|
|
||||||
|
#[allow(unused_imports)]
|
||||||
|
use objectprotocol::ObjectProtocol;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_compatible_size() {
|
fn test_compatible_size() {
|
||||||
// for the cast in PyBuffer::shape()
|
// for the cast in PyBuffer::shape()
|
||||||
|
@ -616,6 +616,7 @@ mod test {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
#[cfg(Py_3)] // array.array doesn't implement the buffer protocol in python 2.7
|
||||||
fn test_array_buffer() {
|
fn test_array_buffer() {
|
||||||
let gil = Python::acquire_gil();
|
let gil = Python::acquire_gil();
|
||||||
let py = gil.python();
|
let py = gil.python();
|
||||||
|
|
|
@ -103,7 +103,7 @@
|
||||||
//!
|
//!
|
||||||
//! The extension module can then be imported into Python:
|
//! The extension module can then be imported into Python:
|
||||||
//!
|
//!
|
||||||
//! ```python1
|
//! ```python
|
||||||
//! >>> import hello
|
//! >>> import hello
|
||||||
//! >>> hello.run()
|
//! >>> hello.run()
|
||||||
//! Rust says: Hello Python!
|
//! Rust says: Hello Python!
|
||||||
|
|
|
@ -117,8 +117,8 @@ impl PyDict {
|
||||||
let mut key: *mut ffi::PyObject = mem::uninitialized();
|
let mut key: *mut ffi::PyObject = mem::uninitialized();
|
||||||
let mut value: *mut ffi::PyObject = mem::uninitialized();
|
let mut value: *mut ffi::PyObject = mem::uninitialized();
|
||||||
while ffi::PyDict_Next(self.as_ptr(), &mut pos, &mut key, &mut value) != 0 {
|
while ffi::PyDict_Next(self.as_ptr(), &mut pos, &mut key, &mut value) != 0 {
|
||||||
vec.push((PyObject::from_owned_ptr(py, key),
|
vec.push((PyObject::from_borrowed_ptr(py, key),
|
||||||
PyObject::from_owned_ptr(py, value)));
|
PyObject::from_borrowed_ptr(py, value)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
vec
|
vec
|
||||||
|
@ -254,7 +254,7 @@ mod test {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_items_list() {
|
fn test_items_list() {
|
||||||
let gil = Python::acquire_gil();
|
let gil = Python::acquire_gil();
|
||||||
let py = gil.python();
|
let py = gil.python();
|
||||||
let mut v = HashMap::new();
|
let mut v = HashMap::new();
|
||||||
v.insert(7, 32);
|
v.insert(7, 32);
|
||||||
|
|
|
@ -273,7 +273,7 @@ mod test {
|
||||||
assert_eq!(false, seq.contains(py, &needle).unwrap());
|
assert_eq!(false, seq.contains(py, &needle).unwrap());
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
//#[test]
|
||||||
fn test_seq_contains() {
|
fn test_seq_contains() {
|
||||||
let gil = Python::acquire_gil();
|
let gil = Python::acquire_gil();
|
||||||
let py = gil.python();
|
let py = gil.python();
|
||||||
|
|
Loading…
Reference in a new issue