Skip to content

Basic object abstractionΒ #5

@emmatyping

Description

@emmatyping

We need a basic abstraction over the object layer.

This includes:

  1. PyObject - abstract objects
  2. str, bytes, list, tuple, etc. - concrete objects
  3. Conversion between concrete and abstract objects

Creating custom objects (classes) is a separate task

Things to keep in mind:

  1. since a PyObject can be mutated by C code anywhere at any time, we can never have an &mut PyObject.
  2. since & references are immutable we need to specify that the object abstraction has interior mutability

Therefore I propose we use the definition from PyO3:
https://github.com/PyO3/pyo3/blob/ab7b0d303be0c3948866519583dd32332f6c3d22/src/types/any.rs#L33
i.e. a transparent wrapper around UnsafeCell<ffi::PyObject>

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions