Skip to content

Python 3.12 and generics #201

Closed
Closed
@dantownsend

Description

We use slotscheck in the CI for Piccolo and sister projects.

For Python 3.12, they changed Generic - it no longer defines __slots__.

This means code like this now fails slotscheck:

https://github.com/piccolo-orm/piccolo/blob/febe5bbdc76cbcba50a994187cf9d953d52a00d3/piccolo/engine/base.py#L27

I know there's a new syntax for defining generics in Python 3.12, but as Piccolo supports Python 3.8 and above, it's harder to implement.

Any ideas how we can fix this? Maybe a special case for Generic in slotscheck (I haven't checked whether using Generic does invalidate the slots in child classes, but I assume not).

Thanks!

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions