Commit 541f949c authored by Tiago Peixoto's avatar Tiago Peixoto
Browse files

Fix PropertyMap.coerce_type() with python::object

parent d2990fbf
Pipeline #670 passed with stage
in 731 minutes and 37 seconds
...@@ -430,6 +430,7 @@ class PropertyMap(object): ...@@ -430,6 +430,7 @@ class PropertyMap(object):
"long double", "vector<bool>", "vector<int16_t>", "long double", "vector<bool>", "vector<int16_t>",
"vector<int32_t>", "vector<int64_t>", "vector<double>", "vector<int32_t>", "vector<int64_t>", "vector<double>",
"vector<long double>", "string", "vector<string>"] "vector<long double>", "string", "vector<string>"]
p = None
for t in types: for t in types:
try: try:
p = self.copy(value_type=t, full=full) p = self.copy(value_type=t, full=full)
...@@ -439,8 +440,10 @@ class PropertyMap(object): ...@@ -439,8 +440,10 @@ class PropertyMap(object):
continue continue
if p.copy(value_type=self.value_type(), full=full) == self: if p.copy(value_type=self.value_type(), full=full) == self:
break break
except (TypeError, ValueError, OverflowError): except (TypeError, ValueError, OverflowError, AttributeError):
pass pass
if p is None:
p = self.copy()
return p return p
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment