@@ -385,10 +385,10 @@ static int nb_type_setattro(PyObject* obj, PyObject* name, PyObject* value) {
385385 return NB_SLOT (PyType_Type, tp_setattro)(obj, name, value);
386386}
387387
388- #if PY_VERSION_HEX < 0x030C0000
388+ #if NB_TYPE_FROM_METACLASS_IMPL || NB_TYPE_GET_SLOT_IMPL
389389
390390struct nb_slot {
391- #if PY_VERSION_HEX < 0x030A0000
391+ #if NB_TYPE_GET_SLOT_IMPL
392392 uint8_t indirect_1;
393393 uint8_t indirect_2;
394394#endif
@@ -400,7 +400,7 @@ template <size_t I1, size_t I2, size_t Offset1, size_t Offset2> nb_slot constexp
400400 static_assert (I1 == I2 && (Offset1 % sizeof (void *)) == 0 && (Offset2 % sizeof (void *)) == 0 ,
401401 " nb_slot construction: internal error" );
402402
403- #if PY_VERSION_HEX < 0x030A0000
403+ #if NB_TYPE_GET_SLOT_IMPL
404404 size_t o = 0 ;
405405 switch (Offset1) {
406406 case offsetof (PyHeapTypeObject, as_async): o = offsetof (PyTypeObject, tp_as_async); break ;
@@ -518,7 +518,7 @@ static constexpr nb_slot type_slots[] {
518518#endif
519519};
520520
521- #if PY_VERSION_HEX < 0x030A0000
521+ #if NB_TYPE_GET_SLOT_IMPL
522522void *type_get_slot (PyTypeObject *t, int slot_id) {
523523 nb_slot slot = type_slots[slot_id - 1 ];
524524
@@ -537,7 +537,7 @@ void *type_get_slot(PyTypeObject *t, int slot_id) {
537537
538538static PyObject *nb_type_from_metaclass (PyTypeObject *meta, PyObject *mod,
539539 PyType_Spec *spec) {
540- #if PY_VERSION_HEX >= 0x030C0000
540+ #if NB_TYPE_FROM_METACLASS_IMPL == 0
541541 // Life is good, PyType_FromMetaclass() is available
542542 return PyType_FromMetaclass (meta, mod, spec, nullptr );
543543#else
0 commit comments