summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeal Norwitz <nnorwitz@gmail.com>2008-01-24 04:14:50 (GMT)
committerNeal Norwitz <nnorwitz@gmail.com>2008-01-24 04:14:50 (GMT)
commitbf839e2efa78a4668105846c4d406f968343bff4 (patch)
treec0cb7bef2cc9f0b20f30f94b4ea54c84db26a574
parentf336c8b7e91f389c8af4255f589849b16ee3dcb5 (diff)
downloadcpython-bf839e2efa78a4668105846c4d406f968343bff4.zip
cpython-bf839e2efa78a4668105846c4d406f968343bff4.tar.gz
cpython-bf839e2efa78a4668105846c4d406f968343bff4.tar.bz2
Fix the tests by restoring __import__. I think the test is still valid.
-rw-r--r--Lib/test/test_descr.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/Lib/test/test_descr.py b/Lib/test/test_descr.py
index 085592a..3f5ef8d 100644
--- a/Lib/test/test_descr.py
+++ b/Lib/test/test_descr.py
@@ -4481,7 +4481,6 @@ def test_borrowed_ref_4_segfault():
import types
import __builtin__
-
class X(object):
def __getattr__(self, name):
# this is called with name == '__bases__' by PyObject_IsInstance()
@@ -4498,9 +4497,12 @@ def test_borrowed_ref_4_segfault():
return (self, args)
# make an unbound method
- __builtin__.__import__ = types.MethodType(Y(), None, (pseudoclass, str))
- import spam
-
+ orig_import = __import__
+ try:
+ __builtin__.__import__ = types.MethodType(Y(), None, (pseudoclass, str))
+ import spam
+ finally:
+ __builtin__.__import__ = orig_import
def test_main():
#XXXweakref_segfault() # Must be first, somehow