Content-Length: 293336 | pFad | http://github.com/python/cpython/commit/665ca055c032f6363050c9a33f37e9d4394900a2

C1 gh-136535: Tests: Correct `Py_TPFLAGS_MANAGED_DICT` in `test_class.py` · python/cpython@665ca05 · GitHub
Skip to content

Commit 665ca05

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 665ca05

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

Lib/test/test_class.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -859,12 +859,14 @@ 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
866869

867-
868870
class WithAttrs:
869871

870872
def __init__(self):
@@ -873,6 +875,13 @@ def __init__(self):
873875
self.c = 3
874876
self.d = 4
875877

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

877886
class TestInlineValues(unittest.TestCase):
878887

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/python/cpython/commit/665ca055c032f6363050c9a33f37e9d4394900a2

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy