Fix overriding static properties in derived classes

Fixes #775.

Assignments of the form `Type.static_prop = value` should be translated to
`Type.static_prop.__set__(value)` except when `isinstance(value, static_prop)`.
This commit is contained in:
Dean Moldovan
2017-04-06 23:45:12 +02:00
parent db200955b9
commit e0e2ea3378
3 changed files with 28 additions and 2 deletions

View File

@@ -110,6 +110,12 @@ def test_static_properties():
assert Type.def_readwrite_static == 2
assert instance.def_readwrite_static == 2
# It should be possible to override properties in derived classes
from pybind11_tests import TestPropertiesOverride as TypeOverride
assert TypeOverride().def_readonly == 99
assert TypeOverride.def_readonly_static == 99
def test_static_cls():
"""Static property getter and setters expect the type object as the their only argument"""