From 835cf73e574140e7c4eb8e0bf1650035751b2ce2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Chapoton?= Date: Thu, 21 Mar 2024 10:57:26 +0100 Subject: [PATCH] clean cython-lint warnings + some typos --- README.md | 2 +- memory_allocator/memory.pxd | 13 ++++++++----- memory_allocator/memory_allocator.pyx | 5 +++-- memory_allocator/signals.pxd | 3 ++- setup.py | 2 +- 5 files changed, 15 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index fd3cdaf..dd23baa 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ It provides a single extension class `MemoryAllocator` with `cdef` methods - `malloc`, - `calloc`, -- `alloarray`, +- `allocarray`, - `realloc`, - `reallocarray`, - `aligned_malloc`, diff --git a/memory_allocator/memory.pxd b/memory_allocator/memory.pxd index c5538b6..856ba00 100644 --- a/memory_allocator/memory.pxd +++ b/memory_allocator/memory.pxd @@ -1,5 +1,8 @@ -# Copied from https://github.com/sagemath/cysignals/blob/master/src/cysignals/memory.pxd. -# Note that this is no longer interruption safe, as we efficiently remove ``sig_block``/``sig_unblock``. +# Copied from +# https://github.com/sagemath/cysignals/blob/master/src/cysignals/memory.pxd + +# Note that this is no longer interruption safe, +# as we efficiently remove ``sig_block``/``sig_unblock``. """ Memory allocation functions which are interrupt-safe @@ -8,7 +11,7 @@ functions. The ``check_`` variants check the return value and raise ``MemoryError`` in case of failure. """ -#***************************************************************************** +# **************************************************************************** # Copyright (C) 2011-2016 Jeroen Demeyer # # cysignals is free software: you can redistribute it and/or modify it @@ -22,9 +25,9 @@ functions. The ``check_`` variants check the return value and raise # GNU Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public License -# along with cysignals. If not, see . +# along with cysignals. If not, see . # -#***************************************************************************** +# **************************************************************************** cimport cython diff --git a/memory_allocator/memory_allocator.pyx b/memory_allocator/memory_allocator.pyx index 57538cc..d21c802 100644 --- a/memory_allocator/memory_allocator.pyx +++ b/memory_allocator/memory_allocator.pyx @@ -51,7 +51,8 @@ cdef class MemoryAllocator: self.pointers[i] = self.static_pointers[i] else: # Case 2: resize pointers - self.pointers = check_reallocarray(self.pointers, new_size, sizeof(void*)) + self.pointers = check_reallocarray(self.pointers, + new_size, sizeof(void*)) self.size = new_size cdef void** find_pointer(self, void* ptr) except NULL: @@ -113,7 +114,7 @@ cdef class MemoryAllocator: return val cdef void* reallocarray(self, void* ptr, size_t nmemb, - size_t size) except? NULL: + size_t size) except? NULL: r""" Re-allocates `ptr` and automatically frees it later. """ diff --git a/memory_allocator/signals.pxd b/memory_allocator/signals.pxd index f49cdd5..93ffcf6 100644 --- a/memory_allocator/signals.pxd +++ b/memory_allocator/signals.pxd @@ -1,6 +1,7 @@ # ``memory.pxd`` is a strict copy of the version in ``cysignals``. -# Usage of ``sig_block`` / ``sig_unblock`` is not necesarry for ``MemoryAllocator``: +# Usage of ``sig_block`` / ``sig_unblock`` is not necessary +# for ``MemoryAllocator``: # One should not wrap its methods with ``sig_on`` ... ``sig_off`` anyway. cdef inline void sig_block() noexcept nogil: diff --git a/setup.py b/setup.py index 39e182c..263497c 100644 --- a/setup.py +++ b/setup.py @@ -19,7 +19,7 @@ def run(self): Extension( "memory_allocator.test", sources=["memory_allocator/test.pyx"]), - ] +] setup(