Skip to content

Commit c13a23a

Browse files
author
Jonathan Kliem
committed
merge upstream
2 parents df5f370 + 8ff13bb commit c13a23a

File tree

6 files changed

+76
-11
lines changed

6 files changed

+76
-11
lines changed

.github/workflows/build_wheels.yml

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Build
2+
3+
on:
4+
pull_request:
5+
types: [opened, synchronize]
6+
push:
7+
tags:
8+
- '*'
9+
10+
jobs:
11+
build_wheels:
12+
name: Wheels on ${{ matrix.os }}
13+
runs-on: ${{ matrix.os }}
14+
strategy:
15+
matrix:
16+
os: [ubuntu-latest, macos-latest, windows-latest]
17+
steps:
18+
- uses: actions/checkout@v2
19+
20+
- name: Build wheels
21+
uses: pypa/[email protected]
22+
# to supply options, put them in 'env', like:
23+
# env:
24+
# CIBW_SOME_OPTION: value
25+
26+
- uses: actions/upload-artifact@v2
27+
with:
28+
path: ./wheelhouse/*.whl
29+
30+
build_sdist:
31+
name: Build source distribution
32+
runs-on: ubuntu-latest
33+
steps:
34+
- uses: actions/checkout@v2
35+
- uses: actions/setup-python@v2
36+
name: Install Python
37+
with:
38+
python-version: '3.8'
39+
40+
- name: Build sdist
41+
run: python setup.py sdist
42+
43+
- uses: actions/upload-artifact@v2
44+
with:
45+
path: dist/*.tar.gz

.github/workflows/main.yml

+9-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,13 @@ jobs:
1515
fail-fast: false
1616
matrix:
1717
os: [ubuntu-latest, macos-latest, windows-latest]
18-
python-version: [3.6, 3.7, 3.8, 3.9]
18+
python-version: ['3.6', '3.7', '3.8', '3.9', '3.10']
19+
architecture: [x64, x86]
20+
exclude:
21+
- os: ubuntu-latest
22+
architecture: x86
23+
- os: macos-latest
24+
architecture: x86
1925
steps:
2026
- name: Set up the repository
2127
uses: actions/checkout@v2
@@ -26,6 +32,7 @@ jobs:
2632
uses: actions/setup-python@v2
2733
with:
2834
python-version: ${{ matrix.python-version }}
35+
architecture: ${{ matrix.architecture }}
2936
- name: Install dependencies
3037
run: |
3138
python -m pip install --upgrade pip
@@ -36,5 +43,5 @@ jobs:
3643
- name: Local build
3744
run: |
3845
python setup.py build_ext -i
39-
python test.py
46+
python test.py || exit 1
4047
git clean -xfd

README.md

+10
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,13 @@ It provides a single extension class `MemoryAllocator` with `cdef` methods
1616

1717
Memory is freed when the instance of `MemoryAllocator` is deallocated.
1818
On failure to allocate the memory, a proper error is raised.
19+
20+
# Changelog
21+
22+
## 0.1.1
23+
24+
- Fixed doctests on 32bit systems.
25+
26+
## 0.1.2
27+
28+
- Provide wheels build by github actions.

cydoctest.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,6 @@ def testmod(m=None, *args, **kwargs):
6060
All other arguments are passed directly to doctest.testmod().
6161
"""
6262
fix_module_doctest(m)
63-
result = doctest.testmod(m, *args, **kwargs)
63+
result = doctest.testmod(m, optionflags=doctest.ELLIPSIS, *args, **kwargs)
6464
if result.failed > 0:
6565
sys.exit('%d test(s) failed' % result.failed)

memory_allocator/test.pyx

+9-6
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ cdef class TestMemoryAllocator():
1414
>>> from memory_allocator.test import TestMemoryAllocator
1515
>>> mem = TestMemoryAllocator()
1616
>>> _ = mem.malloc(100)
17-
>>> mem.malloc(2**63)
17+
>>> mem.malloc(mem.size_t_max())
1818
Traceback (most recent call last):
1919
...
20-
MemoryError: failed to allocate 9223372036854775808 bytes
20+
MemoryError: failed to allocate ... bytes
2121
"""
2222
return <size_t> self.mem.malloc(size)
2323

@@ -28,10 +28,10 @@ cdef class TestMemoryAllocator():
2828
>>> from memory_allocator.test import TestMemoryAllocator
2929
>>> mem = TestMemoryAllocator()
3030
>>> _ = mem.calloc(100, 10)
31-
>>> mem.calloc(2**63, 1)
31+
>>> mem.calloc(mem.size_t_max(), 1)
3232
Traceback (most recent call last):
3333
...
34-
MemoryError: failed to allocate 9223372036854775808 * 1 bytes
34+
MemoryError: failed to allocate ... * 1 bytes
3535
"""
3636
return <size_t> self.mem.calloc(nmemb, size)
3737

@@ -42,10 +42,10 @@ cdef class TestMemoryAllocator():
4242
>>> from memory_allocator.test import TestMemoryAllocator
4343
>>> mem = TestMemoryAllocator()
4444
>>> _ = mem.allocarray(100, 10)
45-
>>> mem.allocarray(2**63, 1)
45+
>>> mem.allocarray(mem.size_t_max(), 1)
4646
Traceback (most recent call last):
4747
...
48-
MemoryError: failed to allocate 9223372036854775808 * 1 bytes
48+
MemoryError: failed to allocate ... * 1 bytes
4949
"""
5050
return <size_t> self.mem.allocarray(nmemb, size)
5151

@@ -142,3 +142,6 @@ cdef class TestMemoryAllocator():
142142

143143
def size(self):
144144
return self.mem.size
145+
146+
def size_t_max(self):
147+
return <size_t> -1

setup.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,11 @@ def run(self):
2626

2727
setup(
2828
name='memory_allocator',
29-
version='0.1.1a0',
29+
version='0.1.3a0',
3030
description='An extension class to allocate memory easily with cython',
3131
long_description=long_description,
3232
long_description_content_type='text/markdown',
33-
url='https://github.com/kliem/memory_allocator',
33+
url='https://github.com/sagemath/memory_allocator',
3434
author='Jeroen Demeyer, Nathann Cohen, Jonathan Kliem',
3535
author_email='[email protected]',
3636
license='GPLv3',

0 commit comments

Comments
 (0)