Fixes to value_t to Python conversion
This commit is contained in:
parent
f6c087cfe4
commit
72b1a948de
2 changed files with 13 additions and 5 deletions
|
|
@ -467,7 +467,7 @@ namespace {
|
||||||
case value_t::STRING: // a string object
|
case value_t::STRING: // a string object
|
||||||
return object(handle<>(borrowed(str_to_py_unicode(val.as_string()))));
|
return object(handle<>(borrowed(str_to_py_unicode(val.as_string()))));
|
||||||
case value_t::MASK: // a regular expression mask
|
case value_t::MASK: // a regular expression mask
|
||||||
return object(handle<>(borrowed(str_to_py_unicode(val.as_mask().str()))));
|
return object(val);
|
||||||
case value_t::SEQUENCE: { // a vector of value_t objects
|
case value_t::SEQUENCE: { // a vector of value_t objects
|
||||||
list arglist;
|
list arglist;
|
||||||
foreach (const value_t& elem, val.as_sequence())
|
foreach (const value_t& elem, val.as_sequence())
|
||||||
|
|
@ -495,8 +495,7 @@ namespace {
|
||||||
}
|
}
|
||||||
return object();
|
return object();
|
||||||
case value_t::ANY: // a pointer to an arbitrary object
|
case value_t::ANY: // a pointer to an arbitrary object
|
||||||
assert("Attempted to convert an Value.ANY object to Python" == NULL);
|
return object(val);
|
||||||
return object();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -535,8 +534,7 @@ value_t python_interpreter_t::functor_t::operator()(call_scope_t& args)
|
||||||
Py_DECREF(val);
|
Py_DECREF(val);
|
||||||
} else {
|
} else {
|
||||||
Py_DECREF(val);
|
Py_DECREF(val);
|
||||||
throw_(calc_error,
|
return NULL_VALUE;
|
||||||
_("Could not evaluate Python variable '%1'") << name);
|
|
||||||
}
|
}
|
||||||
std::signal(SIGINT, sigint_handler);
|
std::signal(SIGINT, sigint_handler);
|
||||||
return result;
|
return result;
|
||||||
|
|
|
||||||
10
src/value.cc
10
src/value.cc
|
|
@ -1251,6 +1251,16 @@ void value_t::in_place_cast(type_t cast_type)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case MASK:
|
||||||
|
switch (cast_type) {
|
||||||
|
case STRING:
|
||||||
|
set_string(as_mask().str());
|
||||||
|
return;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue