| 1 | use crate::object::*; |
| 2 | use std::ffi::c_int; |
| 3 | use std::ptr::addr_of_mut; |
| 4 | |
| 5 | #[cfg_attr(windows, link(name = "pythonXY"))] |
| 6 | extern "C" { |
| 7 | #[cfg_attr(PyPy, link_name = "PyPyRange_Type")] |
| 8 | pub static mut PyRange_Type: PyTypeObject; |
| 9 | pub static mut PyRangeIter_Type: PyTypeObject; |
| 10 | pub static mut PyLongRangeIter_Type: PyTypeObject; |
| 11 | } |
| 12 | |
| 13 | #[inline] |
| 14 | pub unsafe fn PyRange_Check(op: *mut PyObject) -> c_int { |
| 15 | (Py_TYPE(op) == addr_of_mut!(PyRange_Type)) as c_int |
| 16 | } |