Skip to content

Commit 6050223

Browse files
committed
gh-136535: Tests: Correct Py_TPFLAGS_MANAGED_DICT in test_class.py
The `Py_TPFLAGS_MANAGED_DICT` constant in `Lib/test/test_class.py` was incorrectly set to (1 << 2) instead of the correct (1 << 4) from object.h.
1 parent 49365bd commit 6050223

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

Lib/test/test_class.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -859,7 +859,10 @@ def __init__(self, arg):
859859

860860
from _testinternalcapi import has_inline_values
861861

862-
Py_TPFLAGS_MANAGED_DICT = (1 << 2)
862+
Py_TPFLAGS_MANAGED_DICT = (1 << 4)
863+
864+
class NoManagedDict:
865+
__slots__ = ('a',)
863866

864867
class Plain:
865868
pass
@@ -873,6 +876,13 @@ def __init__(self):
873876
self.c = 3
874877
self.d = 4
875878

879+
class TestNoManagedValues(unittest.TestCase):
880+
def test_flags(self):
881+
self.assertEqual(NoManagedDict.__flags__ & Py_TPFLAGS_MANAGED_DICT, 0)
882+
883+
def test_no_inline_values_for_slots_class(self):
884+
c = NoManagedDict()
885+
self.assertFalse(has_inline_values(c))
876886

877887
class TestInlineValues(unittest.TestCase):
878888

0 commit comments

Comments
 (0)