MAP_JIT is a mmap flag that’s apparently introduced in 10.14. The slides at https://developer.apple.com/videos/play/wwdc2018/702/ mention this flag and the hardened runtime.
With the hardened runtime and code signing mapping memory as writable and executable causes an error.
To check: what happens when using MAP_JIT on older versions of macOS (10.9 - 10.13)?
Also: File issue with CPython for the same thing in ctypes when I have a proper solution for PyObjC.