Skip to content

setter on metaclass is not invoked #1208

@slozier

Description

@slozier

Ran into this issue while trying to get the typing module working:

class MetaClass(type):
    def __new__(metacls, name, bases, attrdict, **kwargs):
        return type.__new__(metacls, name, bases, attrdict)

    @property
    def test(self):
        return 1

    @test.setter
    def test(self, value):
        raise Exception

class Generic(metaclass=MetaClass):
    pass

assert Generic.test == 1

try:
    Generic.test = 2
except:
    pass
else:
    assert False

@BCSharp since you looked at metaclasses a bit, any ideas?

Metadata

Metadata

Assignees

No one assigned

    Labels

    coreIssues relating to core functionality (e.g. syntax)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions