Skip to content

Commit 02083d9

Browse files
authored
Fix regress with tp_flags in Python 2 (#18)
1 parent 5ff064a commit 02083d9

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/objects/PyTypeObject.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,8 @@ namespace PyExt::Remote {
119119

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

135137
auto PyTypeObject::hasInlineValues() const -> bool
136138
{
139+
if (isPython2())
140+
return false;
137141
auto flagsRaw = remoteType().Field("tp_flags");
138142
auto flags = utils::readIntegral<unsigned long>(flagsRaw);
139143
return flags & (1 << 2); // Py_TPFLAGS_INLINE_VALUES

0 commit comments

Comments
 (0)