From: Neal Norwitz Date: Thu, 24 Jan 2008 04:14:50 +0000 (+0000) Subject: Fix the tests by restoring __import__. I think the test is still valid. X-Git-Tag: v2.6a1~440 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=bf839e2efa78a4668105846c4d406f968343bff4;p=python Fix the tests by restoring __import__. I think the test is still valid. --- diff --git a/Lib/test/test_descr.py b/Lib/test/test_descr.py index 085592add0..3f5ef8df62 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