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?
Reading
PyClassGuard<T>code just now, I think thatPyClassGuardneeds to requireT: 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?