as() now always throws and never creates an invalid object with memset()
This commit is contained in:
parent
251d25346d
commit
dd26e8a014
2 changed files with 14 additions and 19 deletions
|
|
@ -183,8 +183,8 @@ namespace swig
|
|||
{
|
||||
VALUE item = rb_ary_entry(_seq, _index );
|
||||
try {
|
||||
return swig::as<T>(item, true);
|
||||
} catch (std::exception& e) {
|
||||
return swig::as<T>(item);
|
||||
} catch (const std::invalid_argument& e) {
|
||||
char msg[1024];
|
||||
sprintf(msg, "in sequence element %d ", _index);
|
||||
VALUE lastErr = rb_gv_get("$!");
|
||||
|
|
@ -926,7 +926,7 @@ namespace swig
|
|||
VALUE elem = argv[0];
|
||||
int idx = 0;
|
||||
try {
|
||||
Sequence::value_type val = swig::as<Sequence::value_type>( elem, true );
|
||||
Sequence::value_type val = swig::as<Sequence::value_type>( elem );
|
||||
if ( i >= len ) {
|
||||
$self->resize(i-1, val);
|
||||
return $self;
|
||||
|
|
@ -943,7 +943,7 @@ namespace swig
|
|||
}
|
||||
|
||||
}
|
||||
catch( std::invalid_argument )
|
||||
catch( const std::invalid_argument & )
|
||||
{
|
||||
rb_raise( rb_eArgError, "%s",
|
||||
Ruby_Format_TypeError( "",
|
||||
|
|
@ -967,10 +967,10 @@ namespace swig
|
|||
Sequence::iterator start = $self->begin();
|
||||
VALUE elem = argv[idx];
|
||||
try {
|
||||
Sequence::value_type val = swig::as<Sequence::value_type>( elem, true );
|
||||
Sequence::value_type val = swig::as<Sequence::value_type>( elem );
|
||||
$self->insert( start, val );
|
||||
}
|
||||
catch( std::invalid_argument )
|
||||
catch( const std::invalid_argument & )
|
||||
{
|
||||
rb_raise( rb_eArgError, "%s",
|
||||
Ruby_Format_TypeError( "",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue