Skip to content

#[pyclass(frozen)] implementation #2325

@davidhewitt

Description

@davidhewitt

As of merging #1979 we now have a basic #[pyclass(frozen)] working on main. However, it is still undocumented, and the implementation was a bit rough around the edges. Below is a list of things that I wrote down that would be good to clean up / finish off before the 0.17 release is ready to go:

  • I moved a few associated types from PyClass to PyClassImpl (i.e. make them not public). This was necessary to allow some other trait bounds to be just on PyClassImpl. I think this is fine to do, however we should mention in the CHANGELOG.
  • I added a second associated type in PyClassImpl - Mutability and PyClassMutability. It should be possible to just have one.
  • (Internal) documentation for how the new traits work.
  • Documentation for #[pyclass(frozen)] in the guide.
  • Might be nice to benchmark / optimise these new code paths.
  • Now that it's not actually doing borrow checking in the immutable case, I'd like to propose renaming PyCell<T> to PyClassObject<T>.

@mejrs if you're picking up any of these bits feel free to ping on here, just so we don't duplicate work. I'll do the same.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions