carljm · GitHub

facebook-github-bot pushed a commit to facebookincubator/cinder that referenced this pull request

Carl Meyer @facebook-github-bot

Summary:
Backport python/cpython#97875 plus some later updates.
The only change in the backport is that instead of adding `tp_watched` field to the `PyTypeObject` struct, we instead steal 8 bits of `tp_flags`. This is because some extension modules contain statically-defined `PyTypeObject` structs, and we don't want to have to recompile all extensions. If we don't, we'd get junk data from `type->tp_watched` for such statically defined type structs.
There are no free bits in the lower 32 bits of `tp_flags`, but all the upper 32 bits are unused, since CPython supports 32-bit architectures. Since Cinder doesn't, we know those bits are present and free for our use, so we steal the lower 8 of them.
Reviewed By: itamaro
Differential Revision: D47202165
fbshipit-source-id: 370ac09e2bc7502742480cbbd0fb09804102f783

Read the original on github.com ↗