ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> cpp-sig
cpp-sig
[C++-sig] Help with converters ...
by Michele De Stefano other posts by this author
Oct 19 2009 8:35AM messages near this date
Re: [C++-sig] How to install extensions using bjam(?) | Re: [C++-sig] Help with converters ...
Hello to everyone.

I'm stuck with this problem. I'm trying to write a "from Python
converter", from a tuple(tuple,tuple) type to C++.
Clarifying more, the Python type is a tuple, containing 2 tuples.

Now, when I try to implement the "convertible" static member function
of the converter class, I write this (I've extracted only the
interesting part):

static void* convertible(PyObject* obj_ptr) {
		
	using namespace boost::python;

	handle<> 	hndl(borrowed(obj_ptr));
	object	in(hndl);
		
	if (!PyTuple_Check(in.ptr())) return NULL;
		
	extract<const tuple&> 
             get_tup0(in[0]),
             get_tup1(in[1]);
		
        bool
	     t1 = get_tup0.check(),
	     t2 = get_tup1.check();

...... the rest of the code is not necessary ....


The problem is that even if I pass a tuple containing two tuples from
Python, t1 and t2 become "false".
Surely I'm not interfacing properly with Python, but I don't understand why.

Can someone help me to understand ?

Thank you in advance.
Michele


-- 
Michele De Stefano
http://www.linkedin.com/in/micdestefano
http://xoomer.virgilio.it/michele_de_stefano
_______________________________________________
Cplusplus-sig mailing list
Cplusplus-sig@[...].org
http://mail.python.org/mailman/listinfo/cplusplus-sig
Thread:
Michele De Stefano
Hans Meine
Michele De Stefano

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved