diff options
author | Raymond Hettinger <python@rcn.com> | 2003-06-29 15:44:07 (GMT) |
---|---|---|
committer | Raymond Hettinger <python@rcn.com> | 2003-06-29 15:44:07 (GMT) |
commit | 2b6220d88bd2a8821f44468ffc3cb59d60a296a4 (patch) | |
tree | 8a599fdbf77989e0b362a8296ffbac12e37cf335 /Lib/test/test_descr.py | |
parent | c5131bc256dd26eb7d46ec5774a0a42915fac838 (diff) | |
download | cpython-2b6220d88bd2a8821f44468ffc3cb59d60a296a4.zip cpython-2b6220d88bd2a8821f44468ffc3cb59d60a296a4.tar.gz cpython-2b6220d88bd2a8821f44468ffc3cb59d60a296a4.tar.bz2 |
SF bug #762455: Python segfaults when sys.stdout is changed in getattr
* Added unittest that fails before, but not after Neil's fix to ceval.c.
Diffstat (limited to 'Lib/test/test_descr.py')
-rw-r--r-- | Lib/test/test_descr.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/Lib/test/test_descr.py b/Lib/test/test_descr.py index 46e3c48..cb13ff2 100644 --- a/Lib/test/test_descr.py +++ b/Lib/test/test_descr.py @@ -3916,6 +3916,20 @@ def weakref_segfault(): o.whatever = Provoker(o) del o +# Fix SF #762455, segfault when sys.stdout is changed in getattr +def filefault(): + if verbose: + print "Testing sys.stdout is changed in getattr..." + import sys + class StdoutGuard: + def __getattr__(self, attr): + sys.stdout = sys.__stdout__ + raise RuntimeError("Premature access to sys.stdout.%s" % attr) + sys.stdout = StdoutGuard() + try: + print "Oops!" + except RuntimeError: + pass def test_main(): weakref_segfault() # Must be first, somehow @@ -4007,6 +4021,7 @@ def test_main(): isinst_isclass() proxysuper() carloverre() + filefault() if verbose: print "All OK" |