Re: [Pythonmac-SIG] PyObjC and macOS 10.12 (Sierra)

Ronald Oussoren <[email protected]> Mon, 24 Oct 2016 19:37:34 +0200
Newsgroups gmane.comp.python.pyobjc.devel
Message-ID <[email protected]>
> On 13 Oct 2016, at 12:47, Ronald Oussoren <[email protected]> wrote:
> 
> 
>> On 12 Oct 2016, at 23:06, Nicholas Riley <[email protected] <mailto:[email protected]>> wrote:
>> 
>> Have you tried DevToolsSecurity?  Sounds like it might be a
>> security/codesigning issue.
>> 
>> https://developer.apple.com/legacy/library/documentation/Darwin/Reference/ManPages/man8/DevToolsSecurity.8.html <https://developer.apple.com/legacy/library/documentation/Darwin/Reference/ManPages/man8/DevToolsSecurity.8.html>
>> 
> 
> I hadn’t, but changing this doesn’t help.  Debugging on the console isn’t too bad, although I am stuck at the moment while debugging one of the crashes I get running the testsuite on 10.12.
> 
> The two programs below both call DCSGetTermRangeInString, both work on 10.11, but the python version crashes on 10.12. Sadly enough it crashes in a secondary thread that’s doing some work for the DictionaryServices framework. I’m not yet sure why the python script causes a crash of the interpreter.
> 
> # Python
> from DictionaryServices import DCSGetTermRangeInString
> 
> text = "the hello world program"
> rng = DCSGetTermRangeInString(None, text, 5)
> print(rng)
> #end
> 
> // Objective-C
> #import <CoreServices/CoreServices.h>
> #import <Foundation/Foundation.h>
> 
> int main(void)
> {
>    CFRange rng;
> 
>    rng = DCSGetTermRangeInString(NULL, CFSTR("the hello world program"), 5);
>    NSLog(@"%ld %ld", rng.location, rng.length);
>    return 0;
> }
> // end


I can now reproduce the problem using a small extension that doesn’t even touch PyObjC. See <https://bitbucket.org/ronaldoussoren/pyobjc/issues/174/crash-using-dictionaryservices-on-1012>. There is some material difference between /usr/bin/python and a python.org binary installation of Python 3.5.  This demonstrates the same crash using small C extension that exports a function that calls DCSGetTermInRange.

The crash is in a background thread that appears to do work for DCSGetTermInRange.

Next steps:
* Try to reproduce using python.org installer for 2.7
* Try to reproduce using a local build of 3.5.2

Now where did I leave my Yak shaving kit?

Ronald

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most 
engaging tech sites, SlashDot.org! http://sdm.link/slashdot

_______________________________________________
Pyobjc-dev mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/pyobjc-dev