Skip to content

Commit 62ae5fc

Browse files
committed
Improve tuple comparisons
I never noticed this before; but for the comparison to be correct, we need to split the tuple before doing the comparison
1 parent d5164a6 commit 62ae5fc

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

pygccxml/utils/utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def is_str(string):
2626
bool: True or False
2727
2828
"""
29-
if sys.version_info >= (3, 0):
29+
if sys.version_info[:2] >= (3, 0):
3030
return isinstance(string, str)
3131

3232
return isinstance(string, basestring)
@@ -48,7 +48,7 @@ def find_xml_generator(name="castxml"):
4848
4949
"""
5050

51-
if sys.version_info >= (3, 3):
51+
if sys.version_info[:2] >= (3, 3):
5252
path = _find_xml_generator_for_python_greater_equals_33(name)
5353
else:
5454
path = _find_xml_generator_for_legacy_python(name)

unittests/example_tester_wrap.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
sys.modules[__name__].__file__ = example_file
2929

3030
# Run the example
31-
if sys.version_info >= (3, 0):
31+
if sys.version_info[:2] >= (3, 0):
3232
with open(example_file) as f:
3333
code = compile(f.read(), example_file, "exec")
3434
exec(code, None, None)

unittests/parser_test_case.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ def _test_calldef_exceptions(self, calldef, exceptions):
104104
pprint.pformat([delc.name for delc in exceptions_indeed])))
105105

106106

107-
if sys.version_info < (2, 7, 0):
107+
if sys.version_info[:3] < (2, 7, 0):
108108
# Python2.6 does not have the following methods in the unittest module
109109
parser_test_case_t.assertIn = \
110110
lambda parser, a1, a2, *args: parser.assertTrue(a1 in a2, args)

unittests/test_hash.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def test_types_hashes(self):
2525
2626
"""
2727

28-
if sys.version_info[:2] <= (2,7):
28+
if sys.version_info[:2] <= (2, 7):
2929
# _create_type_t_mockup calls inspect.signature, which does not
3030
# exist for legacy Python
3131
return

0 commit comments

Comments
 (0)