-
-
Notifications
You must be signed in to change notification settings - Fork 362
-
-
Notifications
You must be signed in to change notification settings - Fork 362
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
On macos arm64, objc.objc_msgSend seg-faults when called from ipython #562
Comments
Nice repro! Breaks from normal python3 (3.9 from homebrew) by adding
to the top. Trying to figure out exactly what it is that breaks it. Relevant traceback
|
Tracked it back through ipython.
at the top breaks it too. Nothing ipython it seems. Actually breaks it is the wrong word. Without the import, NSString == 0. With it, it has a value and crashes. Adding
fixes it, in both python and ipython. |
@geohot I think the key part of your fix is definitely setting the |
The None thing is definitely an issue, it just means it couldn't find the class, and won't be able to call methods on it. The reason python and ipython were different is just because ipython imported urllib before your code, which loaded Foundation. You found the fix in the other thread though, obviously you can't find NSString if you don't load Foundation! Fixed in my appnope PR. |
I believe this also requires CPython 3.9.1 by python/cpython#21249. ctypes dyld in general doesn't work with cpython 3.9.0 on macOS 11. The patches have been backported in the latest homebrew Python 3.9.0 and conda-forge Python 3.9 builds (3.8, too, perhaps?). |
Related to #561 , ipython/ipykernel/etc will seg-fault when running the following test code (based on appnope):
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.
The text was updated successfully, but these errors were encountered: