Skip to content

Commit

Permalink
moved to cython 3.x
Browse files Browse the repository at this point in the history
  • Loading branch information
cnvogelg committed Aug 22, 2023
1 parent 5ee9b19 commit 5b9bb48
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ will be very helpful.
### Optional Packages

- [lhafile - FS Edition][2]: required to use ```.lha``` file scanner
- [cython][3]: (version >= **0.29**) required to rebuild the native module
- [cython][3]: (version >= **3.0.0**) required to rebuild the native module

[1]: https://pip.pypa.io/en/stable/installation/
[2]: https://github.com/FrodeSolheim/python-lhafile
Expand Down
6 changes: 3 additions & 3 deletions machine/pycpu.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,15 @@ cdef extern from "m68k.h":

# wrapper
cdef object pc_changed_func
cdef void pc_changed_func_wrapper(unsigned int new_pc):
cdef void pc_changed_func_wrapper(unsigned int new_pc) noexcept:
pc_changed_func(new_pc)

cdef object reset_instr_func
cdef void reset_instr_func_wrapper():
cdef void reset_instr_func_wrapper() noexcept:
reset_instr_func()

cdef object instr_hook_func
cdef void instr_hook_func_wrapper(unsigned int pc):
cdef void instr_hook_func_wrapper(unsigned int pc) noexcept:
instr_hook_func()

# public CPUContext
Expand Down
8 changes: 4 additions & 4 deletions machine/pymem.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ cdef check_mem_exc():
mem_callback_exc = None
raise exc[0], exc[1], exc[2]

cdef void trace_func_wrapper(int mode, int width, uint addr, uint val, void *ctx):
cdef void trace_func_wrapper(int mode, int width, uint addr, uint val, void *ctx) noexcept:
cdef object py_func = <object>ctx
try:
py_func(chr(mode), width, addr, val)
Expand All @@ -60,7 +60,7 @@ cdef void trace_func_wrapper(int mode, int width, uint addr, uint val, void *ctx
mem_callback_exc = sys.exc_info()
m68k_end_timeslice()

cdef void invalid_func_wrapper(int mode, int width, uint addr, void *ctx):
cdef void invalid_func_wrapper(int mode, int width, uint addr, void *ctx) noexcept:
cdef object py_func = <object>ctx
try:
py_func(chr(mode), width, addr)
Expand All @@ -69,7 +69,7 @@ cdef void invalid_func_wrapper(int mode, int width, uint addr, void *ctx):
mem_callback_exc = sys.exc_info()
m68k_end_timeslice()

cdef uint special_read_func_wrapper(uint addr, void *ctx):
cdef uint special_read_func_wrapper(uint addr, void *ctx) noexcept:
cdef object py_func = <object>ctx
try:
return py_func(addr)
Expand All @@ -79,7 +79,7 @@ cdef uint special_read_func_wrapper(uint addr, void *ctx):
m68k_end_timeslice()
return 0

cdef void special_write_func_wrapper(uint addr, uint value, void *ctx):
cdef void special_write_func_wrapper(uint addr, uint value, void *ctx) noexcept:
cdef object py_func = <object>ctx
try:
py_func(addr, value)
Expand Down
2 changes: 1 addition & 1 deletion machine/pytraps.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ cdef object trap_exc_func

from cpython.exc cimport PyErr_Print

cdef void trap_wrapper(uint opcode, uint pc, void *data):
cdef void trap_wrapper(uint opcode, uint pc, void *data) noexcept:
cdef object py_func = <object>data
try:
py_func(opcode, pc)
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[build-system]
requires = ["setuptools", "setuptools-scm", "cython"]
requires = ["setuptools", "setuptools-scm", "cython >= 3.0.0"]
build-backend = "setuptools.build_meta"

[project]
Expand Down
6 changes: 3 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@
from Cython import __version__ as cyver

print("cython version:", cyver)
if parse_version(cyver) < parse_version("0.25"):
print("cython is too old < 0.25! please update first!")
if parse_version(cyver) < parse_version("3.0"):
print("cython is too old < 3.0! please update first!")
sys.exit(1)
except ImportError:
print("cython is too old! please update first!")
Expand Down Expand Up @@ -209,7 +209,7 @@ def run(self):
# use cython?
if use_cython:
sourcefiles.append(cython_file)
extensions = cythonize(extensions)
extensions = cythonize(extensions, language_level="3str")
else:
sourcefiles.append(ext_file)

Expand Down

0 comments on commit 5b9bb48

Please sign in to comment.