Use respondsToSelector instead of hasattr in _breakCycles.#200
Open
typesupply wants to merge 5 commits intomasterfrom
Open
Use respondsToSelector instead of hasattr in _breakCycles.#200typesupply wants to merge 5 commits intomasterfrom
typesupply wants to merge 5 commits intomasterfrom
Conversation
This addresses #145. Closing the test window in the issue goes from taking 0.11 seconds to 0.01 seconds.
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. |
Member
|
looks fine! the callback should only be used with nsObject (vanilla contentViews) approved +1 |
typemytype
requested changes
Dec 22, 2023
Lib/vanilla/vanillaBase.py
Outdated
| obj = view.vanillaWrapper() | ||
| if hasattr(obj, "_breakCycles"): | ||
| obj._breakCycles() | ||
| obj._breakCycles() |
Member
There was a problem hiding this comment.
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
Update this branch.
Suggested by @typemytype in #200.
I don't know why any NSObject would be set as "vanillaWrapper" so remove this test.
Member
|
@typemytype should this get merged? |
Member
Author
|
No. My solution doesn't work very well. It needs more thought. Thanks for checking though. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This addresses #145.
Closing the test window in the issue goes from taking 0.11 seconds to 0.01 seconds.