⚠️ Does `PyClassGuard<T>` require `T: Sync`?
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 16.2k
- Forks
- 1k
- Avg merge
- 2d 6h
- Merged PRs (30d)
- 66
Description
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?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the PyClassGuard implementation and the #[pyclass] macro behavior described in the issue. Check whether concurrent reader access is sound for regular and unsendable pyclasses, then determine whether a type-system bound or another change is required and document the decision.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python, rust
- Domain
- backend-api-design
- Issue type
- Refactor
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100