[Pythonmac-SIG] [Pyobjc-dev] ctypes MemoryError when attempting to launch notarized app

Ronald Oussoren ronaldoussoren at mac.com
Sun Oct 28 05:27:09 EDT 2018



> On 28 Oct 2018, at 06:27, Glyph <glyph at twistedmatrix.com> wrote:
> 
> I adjusted my code-signing to use the new, stricter requirements imposed by app notarization.  I managed to get it successfully notarized, but the app is now non-functional as a result: at startup, I get:
> 
> Traceback (most recent call last):
>   File "my.app/Contents/Resources/__boot__.py", line 93, in <module>
>     _setup_ctypes()
>   File "my.app/Contents/Resources/__boot__.py", line 86, in _setup_ctypes
>     from ctypes.macholib import dyld
>   File "<frozen importlib._bootstrap>", line 971, in _find_and_load
>   File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
>   File "<frozen importlib._bootstrap>", line 656, in _load_unlocked
>   File "<frozen importlib._bootstrap>", line 626, in _load_backward_compatible
>   File "ctypes/__init__.pyc", line 538, in <module>
>   File "ctypes/__init__.pyc", line 273, in _reset_cache
> 
> (If anyone wants to follow along in the traceback, this is using python.org 3.6.6.)

On what version of macOS? I expect 10.14 because that’s the only release that actually knows about notarization, but enabling this feature might also affect how the app is signed.
> 
> This happens before any of my code even runs, so I can't just try to avoid ctypes.

You could patch the __boot__.py file before signing to see if that helps. Although this should cause problems further on, the call to _setup_ctypes should only be created when some code in your app bundle has a dependency on ctypes. 

> 
> Curiously, this is the same traceback that comes from https://forum.kodi.tv/showthread.php?tid=329171, which suggests it's something fundamental to strict shared-library sandboxing that ctypes trips over when trying to initialize itself.
> 
> Does anyone have experience with this, or ideas about what to do?

I’m afraid not. I currently get away with not signing apps at all, although properly supporting signing is on my way too long wish list for py2app.  


With some luck there’s some entitlement or code signing option that causes this problem.  What is the output of "codesign --display --verbose=4” for the application? Both with and without notarisation? 

Ronald

> 
> -glyph
> _______________________________________________
> Pyobjc-dev mailing list
> Pyobjc-dev at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/pyobjc-dev



More information about the Pythonmac-SIG mailing list