Skip to content
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

Use respondsToSelector instead of hasattr in _breakCycles. #200

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

typesupply
Copy link
Member

This addresses #145.

Closing the test window in the issue goes from taking 0.11 seconds to 0.01 seconds.

This addresses #145.

Closing the test window in the issue goes from taking 0.11 seconds to 0.01 seconds.
@typesupply
Copy link
Member Author

@typemytype @justvanrossum Could one of you double check that I'm not making a mistake here. I'm 99% sure it is okay, but since this will affect every vanilla window ever, I'd like another pair of eyes on it.

@typemytype
Copy link
Member

looks fine! the callback should only be used with nsObject (vanilla contentViews)

approved +1

obj = view.vanillaWrapper()
if hasattr(obj, "_breakCycles"):
obj._breakCycles()
obj._breakCycles()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the vanillaWrapper object could be None, fe when weakref has no reference of that object anymore

testing if obj is not None: will not slow down breakCycles

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants