Skip to content

No longer warn for abstract class properties, as they are now supported#10102

Merged
feerrenrut merged 2 commits into
nvaccess:masterfrom
BabbageCom:abstractWarning
Aug 28, 2019
Merged

No longer warn for abstract class properties, as they are now supported#10102
feerrenrut merged 2 commits into
nvaccess:masterfrom
BabbageCom:abstractWarning

Conversation

@LeonarddeR

Copy link
Copy Markdown
Collaborator

Link to issue number:

None

Summary of the issue:

When we introduced abstract auto (class) properties in baseObject (#8393), we introduced an exception for abstract class properties, as they aren't supported by Python 2. In Python 3, abstract class properties are supported.

Description of how this pull request fixes the issue:

When creating a magic auto property, don't check whether the method is a class method.

Testing performed:

Tested the following case:

class Test(baseObject.AutoPropertyObject):
	_abstract_test = True
	@classmethod
	def _get_test(cls):
		return(42)

Test()

As expected, this raises TypeError: Can't instantiate abstract class Test with abstract methods test

Known issues with pull request:

The TypeError is raised when initializing an instance of the class. This is by design of Python itself.

Change log entry:

  • Changes for developers
    • Abstract class properties are now supported on objects that inherit from baseObject.AutoPropertyObject (e.g. NVDAObjects and TextInfos)

@LeonarddeR LeonarddeR requested a review from feerrenrut August 15, 2019 15:07
@feerrenrut feerrenrut merged commit e874975 into nvaccess:master Aug 28, 2019
@nvaccessAuto nvaccessAuto added this to the 2019.3 milestone Aug 28, 2019
feerrenrut added a commit that referenced this pull request Aug 28, 2019
@LeonarddeR LeonarddeR added the BabbageWork Pull requests filed on behalf of Babbage B.V. label Oct 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

BabbageWork Pull requests filed on behalf of Babbage B.V.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants