diff options
Diffstat (limited to 'Examples/test-suite/python/python_destructor_exception_runme.py')
-rw-r--r-- | Examples/test-suite/python/python_destructor_exception_runme.py | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/Examples/test-suite/python/python_destructor_exception_runme.py b/Examples/test-suite/python/python_destructor_exception_runme.py index ee71ab33b..47659531b 100644 --- a/Examples/test-suite/python/python_destructor_exception_runme.py +++ b/Examples/test-suite/python/python_destructor_exception_runme.py @@ -1,7 +1,11 @@ import python_destructor_exception -from StringIO import StringIO import sys +if sys.version_info[0:2] < (3, 0): + import StringIO as io +else: + import io + def error_function(): python_destructor_exception.ClassWithThrowingDestructor().GetBlah() @@ -9,13 +13,13 @@ def runtest(): attributeErrorOccurred = False try: error_function() - except AttributeError, e: + except AttributeError: attributeErrorOccurred = True return attributeErrorOccurred def test1(): stderr_saved = sys.stderr - buffer = StringIO() + buffer = io.StringIO() attributeErrorOccurred = False try: # Suppress stderr while making this call to suppress the output shown by PyErr_WriteUnraisable |