ipython / ipython/ipykernel

On macos arm64, objc.objc_msgSend seg-faults when called from ipython

Đang mở
#562 5 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
Python
Star
734
Fork
412
Merge trung bình
1 ngày 5 giờ
Pull request đã merge (30 ngày)
8

Mô tả

Related to #561 , ipython/ipykernel/etc will seg-fault when running the following test code (based on appnope):

```
import ctypes
import ctypes.util

objc = ctypes.cdll.LoadLibrary(ctypes.util.find_library('objc'))

def _utf8(s):
"""ensure utf8 bytes"""
if not isinstance(s, bytes):
s = s.encode('utf8')
return s

def n(name):
"""create a selector name (for methods)"""
return objc.sel_registerName(_utf8(name))

def C(classname):
"""get an ObjC Class by name"""
return objc.objc_getClass(_utf8(classname))

NSString = C('NSString')

objc.objc_msgSend(NSString, n("stringWithUTF8String:"), _utf8("reason"))
```

The stack trace on an arm64 mac (DTK) says: `python[97504:4905234] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** +[NSString stringWithUTF8String:]: NULL cString'`

Note that this code will work with both system python (macos 11.0.1) and conda-forge python 3.9.0 for osx-arm64. However, it will seg-fault with ipython/ipykernel from conda-forge _or_ with ipython installed with the system python via pip.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.