summaryrefslogtreecommitdiff
path: root/python/ovs/json.py
diff options
context:
space:
mode:
Diffstat (limited to 'python/ovs/json.py')
-rw-r--r--python/ovs/json.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/python/ovs/json.py b/python/ovs/json.py
index e84063fc2..f06204e44 100644
--- a/python/ovs/json.py
+++ b/python/ovs/json.py
@@ -21,10 +21,13 @@ import sys
import six
+PARSER_C = 'C'
+PARSER_PY = 'PYTHON'
try:
import ovs._json
+ PARSER = PARSER_C
except ImportError:
- pass
+ PARSER = PARSER_PY
__pychecker__ = 'no-stringiter'
@@ -91,10 +94,9 @@ class Parser(object):
MAX_HEIGHT = 1000
def __new__(cls, *args, **kwargs):
- try:
+ if PARSER == PARSER_C:
return ovs._json.Parser(*args, **kwargs)
- except NameError:
- return super(Parser, cls).__new__(cls)
+ return super(Parser, cls).__new__(cls)
def __init__(self, check_trailer=False):
self.check_trailer = check_trailer