Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/array.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ use crate::untyped_array::{PyUntypedArray, PyUntypedArrayMethods};
///
/// # Element type and dimensionality
///
/// `PyArray` has two type parametes `T` and `D`.
/// `PyArray` has two type parameters `T` and `D`.
/// `T` represents the type of its elements, e.g. [`f32`] or [`PyObject`].
/// `D` represents its dimensionality, e.g [`Ix2`][type@Ix2] or [`IxDyn`][type@IxDyn].
///
Expand Down Expand Up @@ -293,7 +293,7 @@ impl<T: Element, D: Dimension> PyArray<T, D> {

/// Creates a NumPy array backed by `array` and ties its ownership to the Python object `container`.
///
/// The resulting NumPy array will be writeable from Python space. If this is undesireable, use
/// The resulting NumPy array will be writeable from Python space. If this is undesirable, use
/// [PyReadwriteArray::make_nonwriteable].
///
/// # Safety
Expand Down
2 changes: 1 addition & 1 deletion src/borrow/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,7 @@ where
type Target = PyReadonlyArray<'py, T, D>;

fn deref(&self) -> &Self::Target {
// SAFETY: Exclusive references decay implictly into shared references.
// SAFETY: Exclusive references decay implicitly into shared references.
unsafe { &*(self as *const Self as *const Self::Target) }
}
}
Expand Down
8 changes: 4 additions & 4 deletions src/borrow/shared.rs
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ fn insert_shared<'py>(py: Python<'py>) -> PyResult<NonNull<Shared>> {
// These entry points will be used to access the shared borrow checking API from this extension:

pub fn acquire<'py>(py: Python<'py>, array: *mut PyArrayObject) -> Result<(), BorrowError> {
let shared = get_or_insert_shared(py).expect("Interal borrow checking API error");
let shared = get_or_insert_shared(py).expect("Internal borrow checking API error");

let rc = unsafe { (shared.acquire)(shared.flags, array) };

Expand All @@ -186,7 +186,7 @@ pub fn acquire<'py>(py: Python<'py>, array: *mut PyArrayObject) -> Result<(), Bo
}

pub fn acquire_mut<'py>(py: Python<'py>, array: *mut PyArrayObject) -> Result<(), BorrowError> {
let shared = get_or_insert_shared(py).expect("Interal borrow checking API error");
let shared = get_or_insert_shared(py).expect("Internal borrow checking API error");

let rc = unsafe { (shared.acquire_mut)(shared.flags, array) };

Expand All @@ -199,15 +199,15 @@ pub fn acquire_mut<'py>(py: Python<'py>, array: *mut PyArrayObject) -> Result<()
}

pub fn release<'py>(py: Python<'py>, array: *mut PyArrayObject) {
let shared = get_or_insert_shared(py).expect("Interal borrow checking API error");
let shared = get_or_insert_shared(py).expect("Internal borrow checking API error");

unsafe {
(shared.release)(shared.flags, array);
}
}

pub fn release_mut<'py>(py: Python<'py>, array: *mut PyArrayObject) {
let shared = get_or_insert_shared(py).expect("Interal borrow checking API error");
let shared = get_or_insert_shared(py).expect("Internal borrow checking API error");

unsafe {
(shared.release_mut)(shared.flags, array);
Expand Down
2 changes: 1 addition & 1 deletion src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ impl fmt::Display for AsSliceError {
}
impl_pyerr!(AsSliceError);

/// Inidcates why borrowing an array failed.
/// Indicates why borrowing an array failed.
#[derive(Debug)]
#[non_exhaustive]
pub enum BorrowError {
Expand Down
14 changes: 7 additions & 7 deletions src/npyffi/array.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,24 +115,24 @@ impl PyArrayAPI {
)));
}

let endianess = unsafe {
let endianness = unsafe {
// int PyArray_GetEndianness();
let get_endianess: extern "C" fn() -> c_int =
let get_endianness: extern "C" fn() -> c_int =
api.add(210).cast().read();
get_endianess()
get_endianness()
};

#[cfg(target_endian = "big")]
if endianess != NPY_CPU_BIG {
if endianness != NPY_CPU_BIG {
return Err(PyRuntimeError::new_err(
"module compiled as big endian, but detected different endianess at runtime",
"module compiled as big endian, but detected different endianness at runtime",
));
}

#[cfg(target_endian = "little")]
if endianess != NPY_CPU_LITTLE {
if endianness != NPY_CPU_LITTLE {
return Err(PyRuntimeError::new_err(
"module compiled as little endian, but detected different endianess at runtime",
"module compiled as little endian, but detected different endianness at runtime",
));
}

Expand Down
2 changes: 1 addition & 1 deletion src/sum_products.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ where

/// Return the Einstein summation convention of given tensors.
///
/// This is usually invoked via the the [`einsum!`][crate::einsum!] macro.
/// This is usually invoked via the [`einsum!`][crate::einsum!] macro.
pub fn einsum<'py, T, OUT>(
subscripts: &str,
arrays: &[Borrowed<'_, 'py, PyArray<T, IxDyn>>],
Expand Down
2 changes: 1 addition & 1 deletion src/untyped_array.rs
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ pub trait PyUntypedArrayMethods<'py>: Sealed {
self.shape().iter().product()
}

/// Returns `true` if the there are no elements in the array.
/// Returns `true` if there are no elements in the array.
fn is_empty(&self) -> bool {
self.shape().contains(&0)
}
Expand Down
Loading