Skip to content

Commit

Permalink
Fix regress with tp_flags in Python 2 (#18)
Browse files Browse the repository at this point in the history
  • Loading branch information
maxim-krikun authored Jan 19, 2025
1 parent 5ff064a commit 02083d9
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/objects/PyTypeObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,8 @@ namespace PyExt::Remote {

auto PyTypeObject::getStaticBuiltinIndex() const -> SSize
{
if (isPython2())
return -1;
auto type = remoteType();
auto flagsRaw = type.Field("tp_flags");
auto flags = utils::readIntegral<unsigned long>(flagsRaw);
Expand All @@ -134,6 +136,8 @@ namespace PyExt::Remote {

auto PyTypeObject::hasInlineValues() const -> bool
{
if (isPython2())
return false;
auto flagsRaw = remoteType().Field("tp_flags");
auto flags = utils::readIntegral<unsigned long>(flagsRaw);
return flags & (1 << 2); // Py_TPFLAGS_INLINE_VALUES
Expand Down

0 comments on commit 02083d9

Please sign in to comment.