Skip to content

gh-136535: Tests: Correct Py_TPFLAGS_MANAGED_DICT in test_class.py #136538

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion Lib/test/test_class.py
Original file line number Diff line number Diff line change
Expand Up @@ -859,7 +859,10 @@ def __init__(self, arg):

from _testinternalcapi import has_inline_values

Py_TPFLAGS_MANAGED_DICT = (1 << 2)
Py_TPFLAGS_MANAGED_DICT = (1 << 4)

class NoManagedDict:
__slots__ = ('a',)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
__slots__ = ('a',)
__slots__ = ('a',)

pep 8

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


class Plain:
pass
Expand All @@ -873,6 +876,13 @@ def __init__(self):
self.c = 3
self.d = 4

class TestNoManagedValues(unittest.TestCase):
def test_flags(self):
self.assertEqual(NoManagedDict.__flags__ & Py_TPFLAGS_MANAGED_DICT, 0)

def test_no_inline_values_for_slots_class(self):
c = NoManagedDict()
self.assertFalse(has_inline_values(c))

class TestInlineValues(unittest.TestCase):

Expand Down
Loading