Skip to content

⚠️ Does PyClassGuard<T> require T: Sync? #5407

Description

@davidhewitt

Reading PyClassGuard<T> code just now, I think that PyClassGuard needs to require T: Sync - it allows access from multiple reader threads at the same time.

most #[pyclass] types have this enforced (since #4566), unless they're #[pyclass(unsendable)]. If they're unsendable, the guard code prevents access from multiple threads.

So even though the bound is not enforced in the type system, it's enforced in practice by the macros.

So I think we're ok, but we seem to be treading on thin ice. Does this imply we need to re-think?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No fields configured for Task.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions