Skip to content

Getters and setters added as class attributes, not @property methods #74

@phoerious

Description

@phoerious

These pymethods

#[pymethods]
impl Foo {
    #[getter]
    pub fn readwrite(slf: PyRef<'_, Self>) -> String {
        String::new()
    }
    
    #[setter]
    pub fn set_readwrite<'py>(mut slf: PyRefMut<'py, Self>, data: &str) {}
  
    #[getter]
    pub fn readonly(slf: PyRef<'_, Self>) -> String {
        String::new()
    }
}

should translate to

class Foo:
    @property
    def readwrite(self) -> str: ...
  
    @readwrite.setter
    def readwrite(self, data: str): ...
  
    @property
    def readonly(self) -> str: ...

Instead, they translate to static class attributes without getter/setter logic.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions