Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 921d4f4

Browse files
authored
Merge pull request #12629 from Mottl/pypy-inputhook
Fix issue with PyPy on macOS
2 parents e4ba4f2 + 4b5096e commit 921d4f4

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

setupext.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1270,6 +1270,8 @@ def get_extension(self):
12701270

12711271
ext = make_extension('matplotlib.backends._macosx', sources)
12721272
ext.extra_link_args.extend(['-framework', 'Cocoa'])
1273+
if platform.python_implementation().lower() == 'pypy':
1274+
ext.extra_compile_args.append('-DPYPY=1')
12731275
return ext
12741276

12751277

src/_macosx.m

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@
33
#include <sys/socket.h>
44
#include <Python.h>
55

6+
#ifndef PYPY
67
/* Remove this once Python is fixed: https://bugs.python.org/issue23237 */
78
#define PYOSINPUTHOOK_REPETITIVE 1
9+
#endif
810

911
/* Proper way to check for the OS X version we are compiling for, from
1012
http://developer.apple.com/documentation/DeveloperTools/Conceptual/cross_development */
@@ -277,7 +279,9 @@ static void lazy_init(void) {
277279

278280
NSApp = [NSApplication sharedApplication];
279281

282+
#ifndef PYPY
280283
PyOS_InputHook = wait_for_stdin;
284+
#endif
281285

282286
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
283287
WindowServerConnectionManager* connectionManager = [WindowServerConnectionManager sharedManager];

0 commit comments

Comments
 (0)