summaryrefslogtreecommitdiff
path: root/Lib/test/test_descr.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_descr.py')
-rw-r--r--Lib/test/test_descr.py18
1 files changed, 17 insertions, 1 deletions
diff --git a/Lib/test/test_descr.py b/Lib/test/test_descr.py
index bfa6a642ec..12bec1a304 100644
--- a/Lib/test/test_descr.py
+++ b/Lib/test/test_descr.py
@@ -4,6 +4,7 @@ from test.test_support import verify, vereq, verbose, TestFailed, TESTFN
from test.test_support import get_original_stdout
from copy import deepcopy
import types
+import new
def veris(a, b):
if a is not b:
@@ -1834,6 +1835,10 @@ def specials():
## unsafecmp(1, 1L)
## unsafecmp(1L, 1)
+def recursions():
+ if verbose:
+ print("Testing recursion checks ...")
+
## class Letter(str):
## def __new__(cls, letter):
## if letter == 'EPS':
@@ -1843,7 +1848,6 @@ def specials():
## if not self:
## return 'EPS'
## return self
-
## # sys.stdout needs to be the original to trigger the recursion bug
## import sys
## test_stdout = sys.stdout
@@ -1857,6 +1861,17 @@ def specials():
## raise TestFailed, "expected a RuntimeError for print recursion"
## sys.stdout = test_stdout
+ # Bug #1202533.
+ class A(object):
+ pass
+ A.__mul__ = new.instancemethod(lambda self, x: self * x, None, A)
+ try:
+ A()*2
+ except RuntimeError:
+ pass
+ else:
+ raise TestFailed("expected a RuntimeError")
+
def weakrefs():
if verbose: print("Testing weak references...")
import weakref
@@ -4153,6 +4168,7 @@ def test_main():
overloading()
methods()
specials()
+ recursions()
weakrefs()
properties()
supers()