[Xapian-discuss] int to string TypeError annoyance

Olly Betts olly at survex.com
Mon Mar 21 14:36:43 GMT 2011


On Fri, Mar 11, 2011 at 10:51:41AM +0000, Tim Brody wrote:
> In Perl, 
> 
> $db->set_metadata( "foo", 10 ); 
> 
> Results in,
> 
> 
> TypeError in method 'WritableDatabase_set_metadata', argument 3 of type
> 'std::string const &' 
> 
> It looks like this is thrown by the SWIG
> std::string typemap. Does someone with better SWIG skills than me know how
> to fix SWIG such that it converts the int to a string rather than croaking?

That shouldn't be hard to fix - I'll take a look.

I guess this works fine in the XS bindings because they just coerce the
value to be a string?

> (And besides that it's a very unhelpful error as it has no calling line
> #)  

That might be harder to address.

Cheers,
    Olly



More information about the Xapian-discuss mailing list