Skip to content

Commit

Permalink
ci fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
davidhewitt committed Nov 19, 2020
1 parent acdb7dd commit 84f6834
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 22 deletions.
25 changes: 12 additions & 13 deletions benches/bench_call.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,22 @@ extern crate test;
use pyo3::prelude::*;
use test::Bencher;


macro_rules! test_module {
($py:ident, $code:literal) => {
PyModule::from_code(
$py,
indoc::indoc!($code),
file!(),
"test_module"
).expect("module creation failed")
PyModule::from_code($py, indoc::indoc!($code), file!(), "test_module")
.expect("module creation failed")
};
}

#[bench]
fn bench_call_0(b: &mut Bencher) {
Python::with_gil(|py| {

let module = test_module!(py, r#"
let module = test_module!(
py,
r#"
def foo(): pass
"#);
"#
);

let foo = module.getattr("foo").unwrap();

Expand All @@ -37,11 +34,13 @@ fn bench_call_0(b: &mut Bencher) {
#[bench]
fn bench_call_method_0(b: &mut Bencher) {
Python::with_gil(|py| {

let module = test_module!(py, r#"
let module = test_module!(
py,
r#"
class Foo:
def foo(self): pass
"#);
"#
);

let foo = module.getattr("Foo").unwrap().call0().unwrap();

Expand Down
18 changes: 9 additions & 9 deletions src/ffi/cpython/abstract_.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
use crate::ffi::{Py_ssize_t, PyObject, Py_buffer};
use std::os::raw::{c_int, c_void, c_char};
use crate::ffi::{PyObject, Py_TYPE, Py_buffer, Py_ssize_t};
use std::os::raw::{c_char, c_int, c_void};

#[cfg(all(Py_3_8, not(PyPy)))]
use crate::ffi::{
vectorcallfunc, PyCallable_Check, PyThreadState, PyThreadState_GET, PyTuple_Check,
PyType_HasFeature, Py_TPFLAGS_HAVE_VECTORCALL, Py_TYPE,
PyType_HasFeature, Py_TPFLAGS_HAVE_VECTORCALL,
};

extern "C" {
Expand Down Expand Up @@ -214,7 +214,6 @@ extern "C" {
pub fn PyObject_CheckBuffer(obj: *mut PyObject) -> c_int;
}


#[cfg(not(any(Py_3_9, PyPy)))]
#[inline]
pub unsafe fn PyObject_CheckBuffer(o: *mut PyObject) -> c_int {
Expand Down Expand Up @@ -269,14 +268,11 @@ extern "C" {
#[inline]
pub unsafe fn PyIter_Check(o: *mut PyObject) -> c_int {
(match (*Py_TYPE(o)).tp_iternext {
Some(tp_iternext) => {
tp_iternext != crate::ffi::object::_PyObject_NextNotImplemented as _
}
Some(tp_iternext) => tp_iternext != crate::ffi::object::_PyObject_NextNotImplemented as _,
None => false,
}) as c_int
}


// skipped PySequence_ITEM

pub const PY_ITERSEARCH_COUNT: c_int = 1;
Expand All @@ -285,7 +281,11 @@ pub const PY_ITERSEARCH_CONTAINS: c_int = 3;

extern "C" {
#[cfg(not(PyPy))]
pub fn _PySequence_IterSearch(seq: *mut PyObject, obj: *mut PyObject, operation: c_int) -> Py_ssize_t;
pub fn _PySequence_IterSearch(
seq: *mut PyObject,
obj: *mut PyObject,
operation: c_int,
) -> Py_ssize_t;
}

// skipped _PyObject_RealIsInstance
Expand Down

0 comments on commit 84f6834

Please sign in to comment.