diff options
author | Thomas Waldmann <tw AT waldmann-edv DOT de> | 2011-03-30 16:19:52 +0200 |
---|---|---|
committer | Thomas Waldmann <tw AT waldmann-edv DOT de> | 2011-03-30 16:19:52 +0200 |
commit | 9fe4aaee1e373293418ce1123be3d64b18d6fb29 (patch) | |
tree | 83604f799d6f5546f8ab92be49a32b927df15be5 | |
parent | e233111b1515fd7e9005c30a4053f2a7bb876ee3 (diff) | |
download | argparse-9fe4aaee1e373293418ce1123be3d64b18d6fb29.tar.gz |
fix Python 3.1 compatibility, 1 test failure see note below
Note:
There is one harmless test failure due to "basestring" global name, I added
a comment to the src about it. It is basically same issue as on python 2.3
with "set" and "sorted".
-rw-r--r-- | argparse.py | 4 | ||||
-rw-r--r-- | test/test_argparse.py | 6 |
2 files changed, 9 insertions, 1 deletions
diff --git a/argparse.py b/argparse.py index bfd6127..3bdcd33 100644 --- a/argparse.py +++ b/argparse.py @@ -96,6 +96,10 @@ except NameError: # for python < 2.4 compatibility (sets module is there since 2.3): from sets import Set as set +try: + basestring +except NameError: + basestring = str try: sorted diff --git a/test/test_argparse.py b/test/test_argparse.py index 9141cfb..daead61 100644 --- a/test/test_argparse.py +++ b/test/test_argparse.py @@ -10,7 +10,10 @@ import tempfile import unittest import argparse -from StringIO import StringIO +try: + from StringIO import StringIO +except ImportError: + from io import StringIO class StdIOBuffer(StringIO): pass @@ -4364,6 +4367,7 @@ class TestImportStar(TestCase): if not inspect.ismodule(value) ] # this will fail on python 2.3 due to "set" and "sorted": + # this will fail on python 3.1 due to "basestring" self.assertEqual(sorted(items), sorted(argparse.__all__)) |