Skip to content

Commit

Permalink
try to use basic converter in pickle_converter
Browse files Browse the repository at this point in the history
  • Loading branch information
tkw1536 committed Oct 29, 2018
1 parent c32e47c commit 104e587
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions openmath/convert_pickle.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,10 +141,22 @@ def to_python(self, obj):

def to_openmath(self, o=None, sobj=None):
assert o is None or sobj is None

if o is not None:
try:
return self._basic_converter.to_openmath(o)
except openmath.convert.CannotConvertError:
pass
except ValueError:
pass


if sobj is None:
sobj = pickle.dumps(o, protocol=2)
file = six.BytesIO(sobj)



return OMUnpickler(file, self).load()

##############################################################################
Expand Down

0 comments on commit 104e587

Please sign in to comment.