Skip to content

Commit

Permalink
clean cython-lint warnings + some typos
Browse files Browse the repository at this point in the history
  • Loading branch information
fchapoton committed Mar 21, 2024
1 parent 815e5b1 commit 835cf73
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 10 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ It provides a single extension class `MemoryAllocator` with `cdef` methods

- `malloc`,
- `calloc`,
- `alloarray`,
- `allocarray`,
- `realloc`,
- `reallocarray`,
- `aligned_malloc`,
Expand Down
13 changes: 8 additions & 5 deletions memory_allocator/memory.pxd
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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 <[email protected]>
#
# cysignals is free software: you can redistribute it and/or modify it
Expand All @@ -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 <http://www.gnu.org/licenses/>.
# along with cysignals. If not, see <https://www.gnu.org/licenses/>.
#
#*****************************************************************************
# ****************************************************************************


cimport cython
Expand Down
5 changes: 3 additions & 2 deletions memory_allocator/memory_allocator.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ cdef class MemoryAllocator:
self.pointers[i] = self.static_pointers[i]
else:
# Case 2: resize pointers
self.pointers = <void**>check_reallocarray(self.pointers, new_size, sizeof(void*))
self.pointers = <void**>check_reallocarray(self.pointers,
new_size, sizeof(void*))
self.size = new_size

cdef void** find_pointer(self, void* ptr) except NULL:
Expand Down Expand Up @@ -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.
"""
Expand Down
3 changes: 2 additions & 1 deletion memory_allocator/signals.pxd
Original file line number Diff line number Diff line change
@@ -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:
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def run(self):
Extension(
"memory_allocator.test",
sources=["memory_allocator/test.pyx"]),
]
]


setup(
Expand Down

0 comments on commit 835cf73

Please sign in to comment.