Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update for Cython 3.x (Sourcery refactored) #16

Open
wants to merge 1 commit into
base: development
Choose a base branch
from
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
2 changes: 1 addition & 1 deletion source-code/cython/Primes/primes_pure_malloc.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ def primes(nr_primes: cython.int):
primes[nr_found] = n
nr_found += 1
n += 1
result = [prime for prime in primes[:nr_found]]
result = list(primes[:nr_found])
free(primes)
return result
5 changes: 2 additions & 3 deletions source-code/cython/Primes/primes_pure_python.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@

def primes(nr_primes: cython.int):
primes: cython.int[1000]
if nr_primes > 1000:
nr_primes = 1000
nr_primes = min(nr_primes, 1000)
if not cython.compiled:
primes = [0] * 1000
print('fall back on Python', file=sys.stderr)
Expand All @@ -18,4 +17,4 @@ def primes(nr_primes: cython.int):
primes[nr_found] = n
nr_found += 1
n += 1
return [prime for prime in primes[:nr_found]]
return list(primes[:nr_found])
3 changes: 1 addition & 2 deletions source-code/cython/Primes/primes_vanilla.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
def primes(nr_primes):
primes = [0]*1000
if nr_primes > 1000:
nr_primes = 1000
nr_primes = min(nr_primes, 1000)
n = 2
nr_found = 0
while nr_found < nr_primes:
Expand Down