From 595231dd5cc92c3ac64faa39f22707b5ec58731a Mon Sep 17 00:00:00 2001 From: Yuchen Xie Date: Tue, 26 Jun 2018 06:20:53 +0800 Subject: Update minimal Python version to 2.7 (#4207) --- python/google/protobuf/json_format.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'python/google/protobuf/json_format.py') diff --git a/python/google/protobuf/json_format.py b/python/google/protobuf/json_format.py index 8d338d3e..58c94a47 100644 --- a/python/google/protobuf/json_format.py +++ b/python/google/protobuf/json_format.py @@ -396,11 +396,7 @@ def Parse(text, message, ignore_unknown_fields=False): """ if not isinstance(text, six.text_type): text = text.decode('utf-8') try: - if sys.version_info < (2, 7): - # object_pair_hook is not supported before python2.7 - js = json.loads(text) - else: - js = json.loads(text, object_pairs_hook=_DuplicateChecker) + js = json.loads(text, object_pairs_hook=_DuplicateChecker) except ValueError as e: raise ParseError('Failed to load JSON: {0}.'.format(str(e))) return ParseDict(js, message, ignore_unknown_fields) -- cgit v1.2.3