mirror of
https://github.com/python/cpython.git
synced 2025-11-13 23:46:24 +00:00
Add test for bug #751998.
This commit is contained in:
parent
b47243ae45
commit
98a379eda1
1 changed files with 16 additions and 0 deletions
|
|
@ -1267,6 +1267,22 @@ def slots():
|
||||||
g==g
|
g==g
|
||||||
new_objects = len(gc.get_objects())
|
new_objects = len(gc.get_objects())
|
||||||
vereq(orig_objects, new_objects)
|
vereq(orig_objects, new_objects)
|
||||||
|
class H(object):
|
||||||
|
__slots__ = ['a', 'b']
|
||||||
|
def __init__(self):
|
||||||
|
self.a = 1
|
||||||
|
self.b = 2
|
||||||
|
def __del__(self):
|
||||||
|
assert self.a == 1
|
||||||
|
assert self.b == 2
|
||||||
|
|
||||||
|
save_stderr = sys.stderr
|
||||||
|
sys.stderr = sys.stdout
|
||||||
|
h = H()
|
||||||
|
try:
|
||||||
|
del h
|
||||||
|
finally:
|
||||||
|
sys.stderr = save_stderr
|
||||||
|
|
||||||
def slotspecials():
|
def slotspecials():
|
||||||
if verbose: print "Testing __dict__ and __weakref__ in __slots__..."
|
if verbose: print "Testing __dict__ and __weakref__ in __slots__..."
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue