Skip to content
  • PHP-Proxy

    PHP-Proxy

    Error accessing resource: 429 - Too Many Requests

  • Notifications You must be signed in to change notification settings
  • Fork 7.9k

Backport PR #12603 on branch v3.0.x (FIX: don't import macosx to check if eventloop running) #12605

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

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions lib/matplotlib/backends/__init__.py
Original file line number Diff line number Diff line change
@@ -48,12 +48,8 @@ def _get_running_interactive_framework():
if frame.f_code == tkinter.mainloop.__code__:
return "tk"
frame = frame.f_back
try:
from matplotlib.backends import _macosx
except ImportError:
pass
else:
if _macosx.event_loop_is_running():
if 'matplotlib.backends._macosx' in sys.modules:
if sys.modules["matplotlib.backends._macosx"].event_loop_is_running():
return "macosx"
if sys.platform.startswith("linux") and not os.environ.get("DISPLAY"):
return "headless"
12 changes: 12 additions & 0 deletions src/_macosx.m
Original file line number Diff line number Diff line change
@@ -2580,9 +2580,21 @@ static bool verify_framework(void)
ProcessSerialNumber psn;
/* These methods are deprecated, but they don't require the app to
have started */
#ifdef COMPILING_FOR_10_6
NSApp = [NSApplication sharedApplication];
NSApplicationActivationPolicy activationPolicy = [NSApp activationPolicy];
switch (activationPolicy) {
case NSApplicationActivationPolicyRegular:
case NSApplicationActivationPolicyAccessory:
return true;
case NSApplicationActivationPolicyProhibited:
break;
}
#else
if (CGMainDisplayID()!=0
&& GetCurrentProcess(&psn)==noErr
&& SetFrontProcess(&psn)==noErr) return true;
#endif
PyErr_SetString(PyExc_ImportError,
"Python is not installed as a framework. The Mac OS X backend will "
"not be able to function correctly if Python is not installed as a "