diff options
author | Guido van Rossum <guido@python.org> | 2001-09-29 00:40:25 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2001-09-29 00:40:25 (GMT) |
commit | 751c4c864c5fbdc316d0237243bed1620101e2b5 (patch) | |
tree | 12359022a0427fadad68dd598be5b37ef6584878 /Lib/test | |
parent | 4bb1e36eec19b30f2e582fceffa250e1598262e1 (diff) | |
download | cpython-751c4c864c5fbdc316d0237243bed1620101e2b5.zip cpython-751c4c864c5fbdc316d0237243bed1620101e2b5.tar.gz cpython-751c4c864c5fbdc316d0237243bed1620101e2b5.tar.bz2 |
Add a few ``__dynamic__ = 0'' lines in classes that need to preserve
staticness when __dynamic__ = 1 becomes the default:
- Some classes which are used to test the difference between static
and dynamic.
- Subclasses of complex: complex uses old-style numbers and the slot
wrappers used by dynamic classes only support new-style numbers.
(Ideally, the complex type should be fixed, but that looks like a
labor-intensive job.)
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/test_descr.py | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/Lib/test/test_descr.py b/Lib/test/test_descr.py index 22ae09a..f709233 100644 --- a/Lib/test/test_descr.py +++ b/Lib/test/test_descr.py @@ -832,9 +832,10 @@ def dynamics(): verify(list.__dynamic__ == 0) class S1: __metaclass__ = type + __dynamic__ = 0 verify(S1.__dynamic__ == 0) class S(object): - pass + __dynamic__ = 0 verify(S.__dynamic__ == 0) class D(object): __dynamic__ = 1 @@ -1522,6 +1523,7 @@ def inherits(): verify((+a).__class__ is float) class madcomplex(complex): + __dynamic__ = 0 def __repr__(self): return "%.17gj%+.17g" % (self.imag, self.real) a = madcomplex(-3, 4) @@ -1901,11 +1903,12 @@ def rich_comparisons(): if verbose: print "Testing rich comparisons..." class Z(complex): - pass + __dynamic__ = 0 z = Z(1) verify(z == 1+0j) verify(1+0j == z) class ZZ(complex): + __dynamic__ = 0 def __eq__(self, other): try: return abs(self - other) <= 1e-6 @@ -1992,7 +1995,8 @@ def coercions(): coerce(0, F(0)) coerce(0L, F(0)) coerce(0., F(0)) - class C(complex): pass + class C(complex): + __dynamic__ = 0 coerce(C(0), 0) coerce(C(0), 0L) coerce(C(0), 0.) |