[C++-sig] Newbie : build & return a new list

Benjamin Golinvaux Benjamin.Golinvaux at euresys.com
Fri Nov 21 12:22:26 CET 2003


Hello

I am creating a function like this :

PyObject* testCreateList()
{
	...
	PyObject* newList = PyList_New(...);
	...
	return newList;
}

can I assume that if I wrap it that way :

	def("testCreateList", testCreateList)

Then will it behave correctly wrt references, 
i.e. is doing this :

myList = myTestModule.testCreateList()

the same as 

myList = [ .... ]

?

or do I need to use the manage_new_object call policy ?
I must say I don't understand when manage_new_object needs
to be used.

Also, and this is unrelated, is there a nicer way to create
a list using boost ? 	

I hope I'm not bothering you with my ultrabasic questions. 
If there is some example code I can read to help me going 
from the very simple tutorial to something more complex, 
I'd be glad to read it !

Thank you very much

Benjamin







-----Message d'origine-----
De : c++-sig-bounces at python.org [mailto:c++-sig-bounces at python.org] De la part de Adam Hupp
Envoyé : vendredi 21 novembre 2003 0:14
À : Development of Python/C++ integration
Objet : Re: [C++-sig] threading problem

On Thu, Nov 20, 2003 at 03:34:08PM -0600, manderso at cs.wisc.edu wrote:
> 
> I've been using Boost.Python in my research work for about 6 months 
> now, and I've just recently bumped into a problem with threading 
> during PyFinalize.  It has me confused, and I'm not entirely sure what 
> path to pursue in trying to debug it.  I don't expect anyone to be 
> able to solve the problem from the information herein, but I'm hoping 
> that someone will have an intuition on what *might* be the problem; 
> candidates that I should try to track down.

Long time no see :)

I have admittedly not read your whole mail, but I believe there is a known problem with calling PyFinalize when using boost::python.  I'm sure there's something in the archives about it.

-Adam

_______________________________________________
C++-sig mailing list
C++-sig at python.org
http://mail.python.org/mailman/listinfo/c++-sig 
**************** 
 
The information contained in this message or any of its attachments may be privileged and confidential and intended for the exclusive use of the addressee. If you are not the addressee any disclosure, reproduction, distribution or other dissemination or use of this communication is strictly prohibited. If you have received this transmission by error please notify the sender immediately and then delete this email. 
EURESYS shall not be liable for any loss of or damage to revenues, profits, goodwill, data, information systems or other special, incidental, indirect, consequential or punitive damages of any kind arising in connection with the use of information contained in this mail or its attachments. 
Email transmission cannot be guaranteed to be secure or error free as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or contain viruses. 
The sender therefore is in no way liable for any errors or omissions in the content of this message, which may arise as a result of email transmission. If verification is required, please request a hard copy. 
Please note that neither EURESYS, nor the sender accepts any responsibility for viruses and it is your responsibility to scan attachments (if any). 
**************** 
  


More information about the Cplusplus-sig mailing list