[pypy-svn] r59540 - pypy/trunk/lib-python/modified-2.5.2/test
arigo at codespeak.net
arigo at codespeak.net
Thu Oct 30 12:21:57 CET 2008
Author: arigo
Date: Thu Oct 30 12:21:57 2008
New Revision: 59540
Modified:
pypy/trunk/lib-python/modified-2.5.2/test/test_descr.py
Log:
Anything that showcases a crash caused by a print
only if the print goes to a real file... only makes
sense on CPython.
Modified: pypy/trunk/lib-python/modified-2.5.2/test/test_descr.py
==============================================================================
--- pypy/trunk/lib-python/modified-2.5.2/test/test_descr.py (original)
+++ pypy/trunk/lib-python/modified-2.5.2/test/test_descr.py Thu Oct 30 12:21:57 2008
@@ -1984,28 +1984,29 @@
unsafecmp(1, 1L)
unsafecmp(1L, 1)
- class Letter(str):
- def __new__(cls, letter):
- if letter == 'EPS':
- return str.__new__(cls)
- return str.__new__(cls, letter)
- def __str__(self):
- 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
- sys.stdout = get_original_stdout()
- try:
- # nothing should actually be printed, this should raise an exception
- print Letter('w')
- except RuntimeError:
- pass
- else:
- raise TestFailed, "expected a RuntimeError for print recursion"
- sys.stdout = test_stdout
+ if check_impl_detail:
+ class Letter(str):
+ def __new__(cls, letter):
+ if letter == 'EPS':
+ return str.__new__(cls)
+ return str.__new__(cls, letter)
+ def __str__(self):
+ 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
+ sys.stdout = get_original_stdout()
+ try:
+ # nothing should actually be printed, this should raise an exception
+ print Letter('w')
+ except RuntimeError:
+ pass
+ else:
+ raise TestFailed, "expected a RuntimeError for print recursion"
+ sys.stdout = test_stdout
def weakrefs():
if verbose: print "Testing weak references..."
More information about the Pypy-commit
mailing list