# We're out of type flags, let's add new API for new ones

**URL:** <https://discuss.python.org/t/were-out-of-type-flags-lets-add-new-api-for-new-ones/108540>\
**Category:** C API\
**Created:** [August 13, 2026, 1:53pm UTC](https://discuss.python.org/t/were-out-of-type-flags-lets-add-new-api-for-new-ones/108540 "2026-08-13T13:53:09Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![encukou](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/encukou/32/2461_2.png) [@encukou](https://discuss.python.org/u/encukou)\
**Post date:** [August 13, 2026, 1:53pm UTC](https://discuss.python.org/t/were-out-of-type-flags-lets-add-new-api-for-new-ones/108540/1 "2026-08-13T13:53:09Z")

</div>

We almost ran out of [type flag](https://docs.python.org/3/c-api/typeobj.html#c.PyTypeObject.tp_flags) bits.  
Let’s add more space in 3.16, and while we’re at it, decouple the public API from the internal storage (kinda what `PyType_Spec`/`PySlot` do for `PyTypeObject` struct itself). That way, we can later rearrange the flags or remove obsolete ones… except for the public ones we have in `tp_flags` now.

I’d like to have a design ready before we need to add the next flag, so we don’t need to rush at that point.

# Proposal:

For storage, let’s start with `uint8_t _tp_extra_flags` after `PyTypeObject.tp_watched`, filling up some padding.  
When 8 bits run out, we can add another field. (Or reuse bits if some are obsolete.)

For API:

## Flag IDs

Currently, type flags are represented directly by single-bit masks, for example:

```c
#define Py_TPFLAGS_DISALLOW_INSTANTIATION (1UL << 7)
#define Py_TPFLAGS_IMMUTABLETYPE (1UL << 8)
#define Py_TPFLAGS_HEAPTYPE (1UL << 9)
#define Py_TPFLAGS_BASETYPE (1UL << 10)

```

There’s already a function to get a single flags: `PyType_HasFeature`.  
This does `(tp->tp_flags & flag != 0)`, which technically you can get multiple flags at once (with the result ORed into a single bit). Maybe that’s out-of-spec usage, but it’s a function from 1998; let’s try not to break it.

I still think we can identify flags by _32-bit numbers_. We can:

- let existing flags stay as they are (single bits);
- for new flags, set the currently unassigned bit (1 \<\< 21), with the other bits spelling a unique ID.

Given the name `PyType_HasFeature`, I’m thinking about calling the flags _type features_ in docs, to make it obvious when the new API needs to be is used.

## Getters

In the current `PyType_HasFeature`, the `int` argument changes to `uint32_t`. (This should be an API-compatible change. Also, the function was half-unusable on platforms with 16-bit `int`.)

`int PyType_HasFeature(PyTypeObject *tp, uint32_t feature_id);`

> Return 0 or 1 based on the value of the given feature.  
> Return -1 with exception set on error (`TypeError` on non-type objects,  
> `SystemError` on non-existent or private flags).

Outside Stable ABI, this and the setter below will be `static inline` function that should, if _feature\_id_ is a compile-time constant, compile to a simple read & mask.

I don’t think we need a [DuringGC variant](https://docs.python.org/3.15/c-api/gcsupport.html#duringgc-functions) – the author of `tp_traverse` function should know what their type does.

There should be an internal variant: `_PyType_HasFeature` would be like the above, but _abort_ on error, and allow getting private features.

## Setters

Let’s add a slot for heap types, and a setter function for making static types:

- A slot for creating heap types:

- `int PyType_SetFeature(PyTypeObject *tp, uint32_t feature_id, int value);`

Plus an internal function:

- `int _PyType_SetFeature(PyTypeObject *tp, uint32_t feature_id, int new_value);`

# Sunsetting `Py_TPFLAGS_DEFAULT`

And let’s soft-deprecate `Py_TPFLAGS_DEFAULT` and officially let people use 0. It has been zero for a while anyway. (Note that Stackless Python [doesn’t put “their” bit there](https://github.com/stackless-dev/stackless/blob/57686d4602e8b66f7fb8c602bf48a8bbdb13423b/Include/object.h#L333).)

* * *

Thoughts?

---

<div class="post-metadata">

**Author:** ![vstinner](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/vstinner/32/15130_2.png) [@vstinner](https://discuss.python.org/u/vstinner)\
**Post date:** [August 13, 2026, 3:53pm UTC](https://discuss.python.org/t/were-out-of-type-flags-lets-add-new-api-for-new-ones/108540/2 "2026-08-13T15:53:07Z")

</div>

> [@encukou](#):
>
> We almost ran out of [type flag](https://docs.python.org/3/c-api/typeobj.html#c.PyTypeObject.tp_flags) bits.

Well, there is at least one free bit. IMO we can cleanup the type flags before changing the `PyType` C API.

The bit 21 is not assigned and so is free.

Bit 19 (`Py_TPFLAGS_VALID_VERSION_TAG`) is documented as “Unused. Legacy flag.” We can maybe repurpose it.

Bits 15 and 16 are reserved to [Stackless Python](https://github.com/stackless-dev/stackless). The GitHub repository of this project was archived in February 2025. IMO we can repurpose these bits now.

Sadly, bits 0 (`Py_TPFLAGS_HAVE_FINALIZE`) and 18 (`Py_TPFLAGS_HAVE_VERSION_TAG`) are used by old C extensions built for the stable ABI extensions, so these bits cannot be reused.

`Py_TPFLAGS_READY` and `Py_TPFLAGS_READYING` are only used internally. IMO we should move this state from `tp_flags` to a new `tp_ready` member.

`Py_TPFLAGS_INLINE_VALUES` seems to only be used internally. Maybe we should move it to another `PyTypeObject` member and repurpose the bit 2.

> [@encukou](#):
>
> `int PyType_HasFeature(PyTypeObject *tp, uint32_t feature_id);`

Can’t we move to `uint64_t` instead of `uint32_t`? What would be benefits of replacing `int` with `uint32_t`?

---

<div class="post-metadata">

**Author:** ![encukou](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/encukou/32/2461_2.png) [@encukou](https://discuss.python.org/u/encukou)\
**Post date:** [August 17, 2026, 12:16pm UTC](https://discuss.python.org/t/were-out-of-type-flags-lets-add-new-api-for-new-ones/108540/3 "2026-08-17T12:16:14Z")

</div>

> [@vstinner](#):
>
> The bit 21 is not assigned and so is free.
> 
> Bit 19 (`Py_TPFLAGS_VALID_VERSION_TAG`) is documented as “Unused. Legacy flag.” We can maybe repurpose it.
> 
> Bits 15 and 16 are reserved to [Stackless Python](https://github.com/stackless-dev/stackless).

Yes, without an API change we can repurpose 4 bits.

> [@vstinner](#):
>
> `Py_TPFLAGS_READY` and `Py_TPFLAGS_READYING` are only used internally. IMO we should move this state from `tp_flags` to a new `tp_ready` member.
> 
> `Py_TPFLAGS_INLINE_VALUES` seems to only be used internally. Maybe we should move it to another `PyTypeObject` member and repurpose the bit 2.

Users can still _read_ these, so reusing them would be a backwards-incompatible change.

> [@vstinner](#):
>
> Can’t we move to `uint64_t` instead of `uint32_t`? What would be benefits of replacing `int` with `uint32_t`?

2³¹ is _vastly_ more than the number of flags we’ll need. Even 16 bits would be more than enough, but we couldn’t keep existing flag IDs in `uint16`.

Switching to `uint64_t` would make sense if we keep “naming” flags using individual bits. I don’t think that’s a good idea – it’d encourage another bit-mask style API, coupling the API to underlying storage and making it hard to deprecate/move flags.

---

<div class="post-metadata">

**Author:** ![vstinner](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/vstinner/32/15130_2.png) [@vstinner](https://discuss.python.org/u/vstinner)\
**Post date:** [October 22, 2026, 5:07am UTC](https://discuss.python.org/t/were-out-of-type-flags-lets-add-new-api-for-new-ones/108540/4 "2026-10-22T05:07:35Z")

</div>

Currently, type flags are a bitmask. It’s efficient to store flags (`unsigned long tp_flags;` is enough) and efficient to test if a flag is set (if `flag & tp_flags`). I don’t understand, do you want to store flags differently?

> [@encukou](#):
>
> For storage, let’s start with `uint8_t _tp_extra_flags` after `PyTypeObject.tp_watched`, filling up some padding.  
> When 8 bits run out, we can add another field. (Or reuse bits if some are obsolete.)

Why not changing _tp\_flags_ type to uint64\_t to double the bitmask?

> [@encukou](#):
>
> `int PyType_SetFeature(PyTypeObject *tp, uint32_t feature_id, int value);`

Currently, type flags are bits of _tp\_flags_. How do you store the value of a “feature”? And what would be the use case for a value different than `0` or `1`?

---

<div class="post-metadata">

**Author:** ![encukou](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/encukou/32/2461_2.png) [@encukou](https://discuss.python.org/u/encukou)\
**Post date:** [October 22, 2026, 4:42pm UTC](https://discuss.python.org/t/were-out-of-type-flags-lets-add-new-api-for-new-ones/108540/5 "2026-10-22T16:42:41Z")

</div>

> [@vstinner](#):
>
> Currently, type flags are a bitmask. It’s efficient to store flags (`unsigned long tp_flags;` is enough) and efficient to test if a flag is set (if `flag & tp_flags`). I don’t understand, do you want to store flags differently?

I want to store _some_ flags differently, and (for new flags) make it possible for new Python releases to change where the bits are stored.  
The `PyType_HasFeature` function would contain something like:

```c
switch (feature_id) {
    case Py_TPFLAGS_EXISTING_FLAG: return tp->tp_flags & feature_id;
    case Py_TPFLAGS_SOME_NEW_FLAG: return tp->_tp_newflags1 & 0x20;
    case Py_TPFLAGS_ANOTHER_NEW_FLAG: return tp->_tp_newflags2 & 0x40;
    case Py_TPFLAGS_SOME_OBSOLETE_FLAG: return 1;
    ...
}

```

In the non-limited API, this would be `static inline`, so it can be as efficient as before.

> [@vstinner](#):
>
> Why not changing tp\_flags type to uint64\_t to double the bitmask?

That would give us a few more flags, but like `tp_flags`, once we add a flag we can’t move it or deprecate & remove it. We’d run out of flags again in the future.

> [@vstinner](#):
>
> Currently, type flags are bits of _tp\_flags_. How do you store the value of a “feature”? And what would be the use case for a value different than `0` or `1`?

They’re still bits. I use `int` in public API, because `bool` is in C99+ only and is problematic for FFI/ABI.

---

<div class="post-metadata">

**Author:** ![pitrou](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/pitrou/32/28_2.png) [@pitrou](https://discuss.python.org/u/pitrou)\
**Post date:** [October 24, 2026, 2:30pm UTC](https://discuss.python.org/t/were-out-of-type-flags-lets-add-new-api-for-new-ones/108540/6 "2026-10-24T14:30:48Z")

</div>

> [@encukou](#):
>
> That would give us a few more flags, but like `tp_flags`, once we add a flag we can’t move it or deprecate & remove it. We’d run out of flags again in the future.

For the record, the lowest tp\_flag value (`1 << 0`) was [introduced in 1998](https://github.com/python/cpython/commit/36eef3c1739cdec3956e5ad86b5887985d249302) and the highest (`1 << 31`) [in 2007](https://github.com/python/cpython/commit/27d517b21b67b54637acd19785f7adfc38fbd8c2).

Meaning it took us 10 years to find a use for those 31 bits. Obviously, that does not allow making reliable predictions about the future, but perhaps adding 32 more bits would buy us another 10 years.

---

<div class="post-metadata">

**Author:** ![pitrou](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/pitrou/32/28_2.png) [@pitrou](https://discuss.python.org/u/pitrou)\
**Post date:** [October 24, 2026, 2:36pm UTC](https://discuss.python.org/t/were-out-of-type-flags-lets-add-new-api-for-new-ones/108540/7 "2026-10-24T14:36:08Z")

</div>

By the way, the C type object structure looks like this currently:

```c
    /* Functions to access object as input/output buffer */
    PyBufferProcs *tp_as_buffer;

    /* Flags to define presence of optional/expanded features */
    unsigned long tp_flags;

    const char *tp_doc; /* Documentation string */

```

Therefore, on a machine with 64-bit pointers, the `tp_flags` is already padded to 64 bits to keep `tp_doc` naturally aligned, regardless of the `unsigned long` size.

---

<div class="post-metadata">

**Author:** ![jamestwebber](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/jamestwebber/32/12799_2.png) [@jamestwebber](https://discuss.python.org/u/jamestwebber)\
**Post date:** [October 24, 2026, 5:01pm UTC](https://discuss.python.org/t/were-out-of-type-flags-lets-add-new-api-for-new-ones/108540/8 "2026-10-24T17:01:52Z")

</div>

Was there no need for any new flags since 2007, it was it just impossible to add one?

I would guess that the scarcity of bits led to a very judicious process for deciding when a new flag was warranted. Knowing that there are only so many slots means that every addition is weighed against unknown future possibilities.

That’s not to say that there’s a need for thousands of flags, but it seems like it’d be good if it were simpler to add, experiment, and deprecate flags.

---

<div class="post-metadata">

**Author:** ![vstinner](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/vstinner/32/15130_2.png) [@vstinner](https://discuss.python.org/u/vstinner)\
**Post date:** [October 25, 2026, 6:35am UTC](https://discuss.python.org/t/were-out-of-type-flags-lets-add-new-api-for-new-ones/108540/9 "2026-10-25T06:35:20Z")

</div>

> [@encukou](#):
>
> The `PyType_HasFeature` function would contain something like:
> 
> ```c
> switch (feature_id) {
> case Py_TPFLAGS_EXISTING_FLAG: return tp->tp_flags & feature_id;
> case Py_TPFLAGS_SOME_NEW_FLAG: return tp->_tp_newflags1 & 0x20;
> case Py_TPFLAGS_ANOTHER_NEW_FLAG: return tp->_tp_newflags2 & 0x40;
> case Py_TPFLAGS_SOME_OBSOLETE_FLAG: return 1;
> ...
> }
> 
> ```

Replacing “flags & mask” with such (long) switch can have a bad impact on performance. Can you run a benchmark?

Is there a need to add new flags right now which justify adding this new infrastructure? If possible, I would prefer to free/reuse a few legacy/unused bits before adding that.

The last time that I converted PyType\_GetFlags() macro to a opaque function recall, it had a negative impact on performance on macOS (which didn’t use LTO at this time): see [comment](https://github.com/python/cpython/issues/83723#issuecomment-1093855569). It made `PyType_Check()` slower. I had to revert the change.

Victor

---

<div class="post-metadata">

**Author:** ![vstinner](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/vstinner/32/15130_2.png) [@vstinner](https://discuss.python.org/u/vstinner)\
**Post date:** [November 7, 2026, 4:24pm UTC](https://discuss.python.org/t/were-out-of-type-flags-lets-add-new-api-for-new-ones/108540/10 "2026-11-07T16:24:49Z")

</div>

> [@vstinner](#):
>
> Can’t we move to `uint64_t` instead of `uint32_t`?

I created [PR gh-161565](https://github.com/python/cpython/pull/161565) to change `PyTypeObject.tp_flags` type to `uint64_t`.

---

<div class="post-metadata">

**Author:** ![encukou](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/encukou/32/2461_2.png) [@encukou](https://discuss.python.org/u/encukou)\
**Post date:** [November 9, 2026, 11:53am UTC](https://discuss.python.org/t/were-out-of-type-flags-lets-add-new-api-for-new-ones/108540/11 "2026-11-09T11:53:18Z")

</div>

> [@vstinner](#):
>
> Replacing “flags & mask” with such (long) switch can have a bad impact on performance. Can you run a benchmark?

Using a [demo implementation](https://github.com/python/cpython/compare/main...encukou:cpython:hasfeature-switch) (the code isn’t at its final location):

- For non-limited API: no performance change if `PyType_HasFeature` is called with a constant flag ID. (For non-constant, it’s 3× slower, but I don’t see _any_ reason to check/optimize for that.)
- For limited API: 2.10→3.90ns on a microbenchmark, or slightly less than 2× worse. But:
  - this decoupling is _exactly_ the limited API exists for
  - if this is a major concern: for the existing flags, which are part of the stable ABI, we can _also_ use a switch in an inline function, bringing performance back to the original. But I’d prefer doing that as needed, for individual flags only.

---

<div class="post-metadata">

**Author:** ![encukou](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/encukou/32/2461_2.png) [@encukou](https://discuss.python.org/u/encukou)\
**Post date:** [November 9, 2026, 12:09pm UTC](https://discuss.python.org/t/were-out-of-type-flags-lets-add-new-api-for-new-ones/108540/12 "2026-11-09T12:09:58Z")

</div>

> [@jamestwebber](#):
>
> Was there no need for any new flags since 2007, it was it just impossible to add one?

No _public_ flags were added. Some internal ones were added but encoded in other ways, for example free-threading’s `_Py_TYPE_REVEALED_FLAG` uses a bit in `PyObject.ob_flags` rather than `PyTypeObject.tp_flags`.

---

<div class="post-metadata">

**Author:** ![da-woods](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/da-woods/32/7507_2.png) [@da-woods](https://discuss.python.org/u/da-woods)\
**Post date:** [November 9, 2026, 12:55pm UTC](https://discuss.python.org/t/were-out-of-type-flags-lets-add-new-api-for-new-ones/108540/13 "2026-11-09T12:55:16Z")

</div>

> [@encukou](#):
>
> For limited API: 2.10→3.90ns on a microbenchmark, or slightly less than 2× worse. But:
> 
> - […]
> - if this is a major concern: for the existing flags, which are part of the stable ABI, we can _also_ use a switch in an inline function, bringing performance back to the original. But I’d prefer doing that as needed, for individual flags only.

Some quick notes on where Cython checks flags in the Limited API, in case it’s useful:

- In pattern matching to identify Mapping vs Sequence. Note that this is already a bit of a hack because we’re not supposed to know those particular flags, but we work it out at runtime by inspecting the `collections.abc` classes. This is probably fairly performance-critical and hard to work around.
- `Py_TPFLAGS_UNICODE_SUBCLASS` on dictionary keys in some function call code. There would be other ways of expressing this.
- Checking for base-class heaptype in `tp_travserse` and `tp_dealloc`. This is pretty common and might be worth a quick way of doing it.
- ~`Py_TPFLAGS_HAVE_AM_SEND` - doesn’t apply to newer Limited API versions.~ edit: ignore this - doesn’t really apply
- `Py_TPFLAGS_IS_ABSTRACT` in a few cases I don’t really understand to do with not putting abstract types in a freelist.
- `Py_TPFLAGS_HAVE_GC` in some function dispatch code as a crude attempt to identify user-classes Python-implemented derived classes. If this became slow we’d just drop the check.

My view is “is heaptype” is important, and “mapping vs sequence” is important (but is currently outside a strict reading of the Limited API anyway). Most other uses aren’t really.

---

<div class="post-metadata">

**Author:** ![encukou](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/encukou/32/2461_2.png) [@encukou](https://discuss.python.org/u/encukou)\
**Post date:** [November 9, 2026, 3:10pm UTC](https://discuss.python.org/t/were-out-of-type-flags-lets-add-new-api-for-new-ones/108540/14 "2026-11-09T15:10:12Z")

</div>

> [@vstinner](#):
>
> I created [PR gh-161565](https://github.com/python/cpython/pull/161565) to change `PyTypeObject.tp_flags` type to `uint64_t`.

That solves the immediate problem.  
But it doesn’t decouple the internal flag storage from the API, so it puts any new flags in the same situation as the old ones – the bit positions will be part of the stable ABI, so we can’t remove or reassign them. And that means we need to be very careful in assigning them. (And, for example, a non-CPython implementation can’t just reserve a bit for itself, the way we got `Py_TPFLAGS_HAVE_STACKLESS_EXTENSION` back in the day.)

If we’re changing things, I’d really like to solve that part, too.

* * *

> [@da-woods](#):
>
> Some quick notes on where Cython checks flags in the Limited API

- For Mapping vs. Sequence, you probably want a _public_ API first before the limited one.
- For `Py_TPFLAGS_UNICODE_SUBCLASS`, ideally switch to `PyUnicode_Check`. On CPython that’ll probably always be a `#define` for checking the flag, but if there’s ever a better implementation specifically for `isinstance(str)`, we’ll switch to that.
- For heaptype/`tp_traverse`/`tp_dealloc` I do have something in the works. If that doesn’t pan out, yes, this is the best candidate for keeping a fast bit check
- `Py_TPFLAGS_IS_ABSTRACT` is interesting. If the flag API was decoupled from the bit storage, we could have, for example, put this on heap types only. The check would then be for two bits (`(tp_flags & Py_TPFLAGS_HEAPTYPE) && (ht_flags && …IS_ABSTRACT))` which should still be fast enough. But, for the existing flags we can’t do things like that.

---

<div class="post-metadata">

**Author:** ![vstinner](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/vstinner/32/15130_2.png) [@vstinner](https://discuss.python.org/u/vstinner)\
**Post date:** [November 9, 2026, 9:35pm UTC](https://discuss.python.org/t/were-out-of-type-flags-lets-add-new-api-for-new-ones/108540/15 "2026-11-09T21:35:01Z")

</div>

There are multiple “Check” functions in the public C API which are implemented by checking for a bit (_feature_) in type flags:

- `PyBytes_Check()`: `Py_TPFLAGS_BYTES_SUBCLASS`
- `PyDict_Check()`: `Py_TPFLAGS_DICT_SUBCLASS`
- `PyExceptionClass_Check()`: `Py_TPFLAGS_BASE_EXC_SUBCLASS`
- `PyExceptionInstance_Check()`: `Py_TPFLAGS_BASE_EXC_SUBCLASS`
- `PyList_Check()`: `Py_TPFLAGS_LIST_SUBCLASS`
- `PyLong_Check()`: `Py_TPFLAGS_LONG_SUBCLASS`
- `PyTuple_Check()`: `Py_TPFLAGS_TUPLE_SUBCLASS`
- `PyType_Check()`: `Py_TPFLAGS_TYPE_SUBCLASS`
- `PyUnicode_Check()`: `Py_TPFLAGS_UNICODE_SUBCLASS`

If possible, I would prefer to not make these functions slower, or only have a minor impact on perfomrance, if we change checks on type flags. The advantage of adding 64-bit type flags is that `PyType_HasFeature()` remains implemented as `type_flags & feature`.

---

<div class="post-metadata">

**Author:** ![vstinner](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/vstinner/32/15130_2.png) [@vstinner](https://discuss.python.org/u/vstinner)\
**Post date:** [November 9, 2026, 9:36pm UTC](https://discuss.python.org/t/were-out-of-type-flags-lets-add-new-api-for-new-ones/108540/16 "2026-11-09T21:36:41Z")

</div>

> [@encukou](#):
>
> But it doesn’t decouple the internal flag storage from the API, so it puts any new flags in the same situation as the old ones – the bit positions will be part of the stable ABI, so we can’t remove or reassign them. And that means we need to be very careful in assigning them. (And, for example, a non-CPython implementation can’t just reserve a bit for itself, the way we got `Py_TPFLAGS_HAVE_STACKLESS_EXTENSION` back in the day.)

Right, we should be even more careful than before when adding new public type flags.

For new internal flags, we are free to add a new member to `PyTypeObject` and use an internal/private API for that.

---

<div class="post-metadata">

**Author:** ![encukou](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/encukou/32/2461_2.png) [@encukou](https://discuss.python.org/u/encukou)\
**Post date:** [November 10, 2026, 9:52am UTC](https://discuss.python.org/t/were-out-of-type-flags-lets-add-new-api-for-new-ones/108540/17 "2026-11-10T09:52:48Z")

</div>

> [@vstinner](#):
>
> If possible, I would prefer to not make these functions slower

My proposal doesn’t slow these down in non-limited API.  
For limited API, we can switch the `Check`s to use `PyType_GetFlags` directly (even though `PyType_GetFlags` would be soft-deprecated, i.e. it wouldn’t return flags added in the future).  
Let’s do that in the initial implementation to avoid slowdowns.
