mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
bpo-39960: Allow heap types in the "Carlo Verre" hack check that override "tp_setattro()" (GH-21092)
Automerge-Triggered-By: @gvanrossum
This commit is contained in:
parent
67673b08ea
commit
148f329135
4 changed files with 120 additions and 11 deletions
|
@ -516,6 +516,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')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue