@@ -49,6 +49,11 @@ from libcpp cimport bool
4949
5050# library files
5151include " config.pxi"
52+
53+ # from Cython 3.0, in the MetaJavaClass, this is accessed as _JavaClass__cls_storage
54+ # see https://cython.readthedocs.io/en/latest/src/userguide/migrating_to_cy30.html#class-private-name-mangling
55+ cdef CLS_STORAGE_NAME = ' _JavaClass__cls_storage' if PYOBJUS_CYTHON_3 else ' __cls_storage'
56+
5257include " debug.pxi"
5358include " common.pxi"
5459include " type_enc.pxi"
@@ -129,7 +134,7 @@ class MetaObjcClass(type):
129134 raise ObjcException(' Unable to find class {0!r}' .format(
130135 __objcclass__))
131136
132- classDict[' __cls_storage ' ] = storage
137+ classDict[CLS_STORAGE_NAME ] = storage
133138
134139 cdef ObjcMethod om
135140 for name, value in classDict.iteritems():
@@ -430,8 +435,8 @@ cdef class ObjcMethod(object):
430435 if res_ptr == NULL :
431436 raise MemoryError (' Unable to allocate res_ptr' )
432437
433- if not self .signature_return.startswith((b' (' , b' {' )):
434- ffi_call(& self .f_cif, < void (* )()>< id (* )(id , SEL)> objc_msgSend, res_ptr, f_args)
438+ if not self .signature_return[ 0 ] .startswith((b' (' , b' {' )):
439+ ffi_call(& self .f_cif, < void (* )() noexcept >< id (* )(id , SEL)> objc_msgSend, res_ptr, f_args)
435440
436441 else :
437442 # TODO FIXME NOTE: Currently this only work on x86_64 architecture and armv7 ios
@@ -460,20 +465,20 @@ cdef class ObjcMethod(object):
460465 stret = True
461466
462467 if stret and MACOS_HAVE_OBJMSGSEND_STRET:
463- ffi_call(& self .f_cif, < void (* )()>< id (* )(id , SEL)> objc_msgSend_stret__safe, res_ptr, f_args)
468+ ffi_call(& self .f_cif, < void (* )() noexcept >< id (* )(id , SEL)> objc_msgSend_stret__safe, res_ptr, f_args)
464469 fun_name = " objc_msgSend_stret"
465470 del_res_ptr = False
466471 else :
467- ffi_call(& self .f_cif, < void (* )()>< id (* )(id , SEL)> objc_msgSend, res_ptr, f_args)
472+ ffi_call(& self .f_cif, < void (* )() noexcept >< id (* )(id , SEL)> objc_msgSend, res_ptr, f_args)
468473 fun_name = " objc_msgSend"
469474 dprint(" x86_64 architecture {0} call" .format(fun_name), of_type = ' i' )
470475
471476 ELIF PLATFORM == ' ios' :
472477 IF ARCH == ' arm64' :
473- ffi_call(& self .f_cif, < void (* )()>< id (* )(id , SEL)> objc_msgSend, res_ptr, f_args)
478+ ffi_call(& self .f_cif, < void (* )() noexcept >< id (* )(id , SEL)> objc_msgSend, res_ptr, f_args)
474479 dprint(' ios(arm64) platform objc_msgSend call' )
475480 ELSE :
476- ffi_call(& self .f_cif, < void (* )()>< id (* )(id , SEL)> objc_msgSend_stret, res_ptr, f_args)
481+ ffi_call(& self .f_cif, < void (* )() noexcept >< id (* )(id , SEL)> objc_msgSend_stret, res_ptr, f_args)
477482 dprint(' ios(armv7) platform objc_msgSend_stret call' )
478483
479484 ELSE :
0 commit comments