mirror of
https://github.com/pybind/pybind11.git
synced 2026-03-14 20:27:47 +00:00
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:
@@ -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"""
|
||||
|
||||
Reference in New Issue
Block a user