smarie/python-pyfields

Under python < 3.6, fields from parent classes may not be fixed if accessed from subclass

smarie opened this issue · 0 comments

Indeed our fix_field does not look at parent classes so this will not work:

class A(object):
    a = field(default='hello')

class B(A):
    pass

b = B()
assert b.a == 'hello'  # first access should have fixed the field name

# make sure that for all python versions (especially 2 and 3.5) the name is now ok.
assert A.__dict__['a'].name == 'a'