pypy / pypy

PyPy is a very fast and compliant implementation of the Python language.
https://pypy.org
Other
790 stars 38 forks source link

cpyext: missing `Py_GenericAliasType` #4914

Open wjakob opened 3 months ago

wjakob commented 3 months ago

I think that PyPy is missing a header declaration for Py_GenericAliasType. It does have Py_GenericAlias but lacks the type that this creates, which is part of the Stable ABI since version 3.9.

I get the following compiler error message

home/runner/work/nanobind/nanobind/src/nb_type.cpp:920:31: error: ‘Py_GenericAliasType’ was not declared in this scope; did you mean ‘Py_GenericAlias’?
  920 |         if (Py_TYPE(base) == &Py_GenericAliasType) {
      |                               ^~~~~~~~~~~~~~~~~~~
      |                               Py_GenericAlias
mattip commented 3 months ago

Right. The class is defined in pure python so we will have to convert that into a PyTypeObject at startup.