From abbd115e645841c2967f3133a84d60ddb8aed873 Mon Sep 17 00:00:00 2001 From: Dmitry Mottl Date: Thu, 25 Oct 2018 14:54:26 +0200 Subject: [PATCH 1/2] Fix issue with PyPy on macOS --- setupext.py | 2 ++ src/_macosx.m | 2 ++ 2 files changed, 4 insertions(+) diff --git a/setupext.py b/setupext.py index de784f051d5f..ba74045077f8 100644 --- a/setupext.py +++ b/setupext.py @@ -1270,6 +1270,8 @@ def get_extension(self): ext = make_extension('matplotlib.backends._macosx', sources) ext.extra_link_args.extend(['-framework', 'Cocoa']) + if platform.python_implementation().lower() == 'pypy': + ext.extra_compile_args.append('-DPYPY=1') return ext diff --git a/src/_macosx.m b/src/_macosx.m index 4f025268ef8d..f7c788022dfb 100644 --- a/src/_macosx.m +++ b/src/_macosx.m @@ -277,7 +277,9 @@ static void lazy_init(void) { NSApp = [NSApplication sharedApplication]; +#ifndef PYPY PyOS_InputHook = wait_for_stdin; +#endif NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init]; WindowServerConnectionManager* connectionManager = [WindowServerConnectionManager sharedManager]; From 4b5096ee52cf2c42ce41748bcb22f3379045c6bd Mon Sep 17 00:00:00 2001 From: Dmitry Mottl Date: Thu, 25 Oct 2018 15:10:22 +0200 Subject: [PATCH 2/2] Comment out PYOSINPUTHOOK_REPETITIVE --- src/_macosx.m | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/_macosx.m b/src/_macosx.m index f7c788022dfb..8ec3ebfae01d 100644 --- a/src/_macosx.m +++ b/src/_macosx.m @@ -3,8 +3,10 @@ #include #include +#ifndef PYPY /* Remove this once Python is fixed: https://bugs.python.org/issue23237 */ #define PYOSINPUTHOOK_REPETITIVE 1 +#endif /* Proper way to check for the OS X version we are compiling for, from http://developer.apple.com/documentation/DeveloperTools/Conceptual/cross_development */