Hacktoberfest 2026:維護者為十月標記出來的 issue,仍然開放、適合新手。 瀏覽 Hacktoberfest issue

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

未關閉
#562 5 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

還沒有人認領這個 Issue。

評估

難度
4/5
預估耗時
3-5 天
新手友好度
32/100
Issue 類型
缺陷
描述清晰度
基本清楚
活躍度
停滯
技術堆疊
jupyter, macos, objective-c, python

研究方向

首先,按照描述在 arm64 macOS 系統上使用 ipython/ipykernel 重現該程式碼片段,並將其與 system Python 和 conda-forge Python 進行比較。追蹤 ctypes objc.objc_msgSend 呼叫並檢視相關的 issue #561;當所示的 Objective-C 呼叫在受影響的 ipython/ipykernel 環境中不再當機時,即表示完成。

由索引模型根據 Issue 內容生成。

描述

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.

主要語言
Python
星號
734
分支
411
平均合併
1 天 2 小時
30 天內合併 PR
9

貢獻指南

開啟貢獻指南

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

ipython/ipykernel 的其他 Issue

查看 ipython/ipykernel 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。