gh-155503: Check Py_TPFLAGS_IMMUTABLETYPE in check_immutable_type() (#155620)
vstinner <[email protected]> Thu, 13 Aug 2026 06:30:17 -0400 (EDT)
| Newsgroups | gmane.comp.python.cvs |
|---|---|
| Message-ID | <[email protected]> |
https://github.com/python/cpython/commit/76f2903865e39e85b6c152114d9522d99969c09d commit: 76f2903865e39e85b6c152114d9522d99969c09d branch: main author: Victor Stinner <[email protected]> committer: vstinner <[email protected]> date: 2026-08-13T12:30:01+02:00 summary: gh-155503: Check Py_TPFLAGS_IMMUTABLETYPE in check_immutable_type() (#155620) Check for the Py_TPFLAGS_IMMUTABLETYPE type flag in test.support.check_immutable_type(). files: M Lib/test/support/__init__.py diff --git a/Lib/test/support/__init__.py b/Lib/test/support/__init__.py index f98da49171dc3b5..3f2caebd21e336c 100644 --- a/Lib/test/support/__init__.py +++ b/Lib/test/support/__init__.py @@ -3484,3 +3484,11 @@ def check_immutable_type(testcase, type): regex = r'cannot set .* attribute of immutable type' with testcase.assertRaisesRegex(TypeError, regex): setattr(type, 'custom_attr', 123) + + try: + from _testlimitedcapi import type_getflags, Py_TPFLAGS_IMMUTABLETYPE + except ImportError: + pass + else: + flags = type_getflags(type) + testcase.assertTrue(flags & Py_TPFLAGS_IMMUTABLETYPE) _______________________________________________ Python-checkins mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3//lists/python-checkins.python.org Member address: [email protected]