Skip to content

Many class attributes should be private or read-only #186

@llucax

Description

@llucax

What's needed?

We have a lot of class attributes that are public, so users can mess with them even when it is not safe to do so.

Just as an example, the Anycast channel has:

        self.limit: int = maxsize  # If changed, the deque is not updated
        self.deque: Deque[T] = deque(maxlen=maxsize) # a user could just add or remove stuff without using the condition variable
        self.send_cv: Condition = Condition()  # users could triggers sends when the deque is full, dropping messages unexpectedly
        self.recv_cv: Condition = Condition()
        self.closed: bool = False # users could mark the channel as open after it was closed.

Proposed solution

Review all class attributes and make them private or read-only as appropriate.

Use cases

No response

Alternatives and workarounds

No response

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    scope:breaking-changeBreaking change, users will need to update their codetype:enhancementNew feature or enhancement visitble to users

    Type

    No type

    Projects

    Status

    Done

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions