Skip to content

Enable recursive classattribute #982

@kngwyu

Description

@kngwyu

We can use Self as a classattribute, like this:

#[pyclass]
struct Foo {}
#[pymethods] 
impl Foo {
    #[classattr] 
    const FOO: Foo = Foo {};
}

.
However, by #975, this is temporally prohibited due to a soundness problem, and thus this code panics.
We should be able to enable this by changing the strategy for initializing tp_dict as suggested by @scalexm in the comment.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions