Avoid Quartz lazyloader from Quartz import *
bug
#20
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I've been having a problem with very long import times/hanging on import.
Specifically,
hangs for in excess of 15 seconds on Mac OS X 10.9.3/Python 2.7.5 with pyobjc v2.5.1.
I've traced the issue back to the pyobjc project, which has a bug discussion containing this message:
https://bitbucket.org/ronaldoussoren/pyobjc/issue/2/faster-metadata-support#comment-5204985
The pymouse/mac.py module uses exactly this
from Quartz import *
import style.Changing this to
import Quartz
and fixing the references to Quartz objects solves the import time issues.I've also added a unit test that checks the import time for pymouse.
Reproducing the bug
Environment
Steps
You should observe at least a 15 second hang with no output or other response. For example:
Results
Before the patch, at version 1.0/b0cc56c:
After changing to
import Quartz
:n.b. I've issued substantially this same Pull Request to the PyUserinput project as well.