Remove AutoPropertyObject dependency on __init__#7833
Merged
Conversation
Missing super call on AutoPropertyObject children no longer causes failure for CachedGetter properties. Previously a class that inherits from AutoPropertyObject and forgot to call super in the __init__ function, would result in a failure for CachedGetter properties.
feerrenrut
added a commit
that referenced
this pull request
Dec 6, 2017
…ewer This implementation of brailleViewerTool relies on #7833 being fixed
michaelDCurran
approved these changes
Dec 6, 2017
Collaborator
|
Might this hide any errors if the addon author orgets to call super in init |
Contributor
Author
|
If they are inheriting directly from |
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.
Link to issue number:
No issue number.
Summary of the issue:
A class that inherits from
AutoPropertyObjectand does not (forgets to) call super in the__init__function, would result in a failure forCachedGetterproperties.An example of this is BrailleBuffer
To reproduce the error, in the NVDA python console:
gives:
Description of how this pull request fixes the issue:
Create the _cachedProperties dictionary in the __new__function, this is always called automatically.
A missing super call on
AutoPropertyObjectchildren no longer causes failure forCachedGetterproperties.While here I noticed that there is the possibility that the generator expression for transforming the dictionary keys (such as
_get_myVal,_set_myVal, and_del_myVal) would result in duplicates ("myVal" would be output 3 times). This results in unnecessary iterations of the loop that follows. Converting this to a set comprehension avoids that.Testing performed:
Ran NVDA and ran the following in the NVDA python console without getting an error:
Known issues with pull request:
None
Change log entry:
None