diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2020-07-03 00:28:41 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-03 00:28:41 (GMT) |
commit | bfec674254ea22ef9c0c335587eb65683f4145c7 (patch) | |
tree | e555e9cd5702dea1896e8940d43caecb61cc472b /Lib | |
parent | 32e9e17c426e814ef94e30337050417ce1f631d3 (diff) | |
download | cpython-bfec674254ea22ef9c0c335587eb65683f4145c7.zip cpython-bfec674254ea22ef9c0c335587eb65683f4145c7.tar.gz cpython-bfec674254ea22ef9c0c335587eb65683f4145c7.tar.bz2 |
bpo-39960: Allow heap types in the "Carlo Verre" hack check that override "tp_setattro()" (GH-21092)
Automerge-Triggered-By: @gvanrossum
(cherry picked from commit 148f32913573c29250dfb3f0d079eb8847633621)
Co-authored-by: scoder <stefan_ml@behnel.de>
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/test/test_capi.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/Lib/test/test_capi.py b/Lib/test/test_capi.py index 4efecfd..5150d57 100644 --- a/Lib/test/test_capi.py +++ b/Lib/test/test_capi.py @@ -515,6 +515,14 @@ class CAPITest(unittest.TestCase): # Test that subtype_dealloc decref the newly assigned __class__ only once self.assertEqual(new_type_refcnt, sys.getrefcount(_testcapi.HeapCTypeSubclass)) + def test_heaptype_with_setattro(self): + obj = _testcapi.HeapCTypeSetattr() + self.assertEqual(obj.pvalue, 10) + obj.value = 12 + self.assertEqual(obj.pvalue, 12) + del obj.value + self.assertEqual(obj.pvalue, 0) + def test_pynumber_tobase(self): from _testcapi import pynumber_tobase self.assertEqual(pynumber_tobase(123, 2), '0b1111011') |