<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
Fredrick,
<p>    Thanks for pointing me in the right direction. 
The only bit of trouble I had was figuring out that I needed to set 'args'
to NULL and use the keyword dictionary parameter instead in the call to
PyInstance_New, i.e.
<pre>PyObject *data = Py_BuildValue("{s:s}", "<name>", "<value>");</pre>

<pre>PyObject *object = PyInstance_New(class_name, NULL, data);</pre>
    It works great!  Thanks again.
<p>Regards,
<p>Bill
<br> 
<p>Fredrik Lundh wrote:
<blockquote TYPE=CITE>bill barrington <bill.barrington@turner.com> wrote:
<br>>     I would like to create a python class instance
using the python/C
<br>> API for eventual return back into "python space".  IOW, I want
to
<br>> accomplish the equivalent of the following python code, but from
within
<br>> an extension:
<br>>
<br>> instance = Class(<whatever>)
<p>start here:
<br><a href="http://www.python.org/doc/current/api/object.html">http://www.python.org/doc/current/api/object.html</a>
<p>and then look at the cPickle.c source code
<br>(see find_class, Instance_New, load_inst, ...).
<p></F>
<p>coming soon:
<br><a href="http://www.pythonware.com/people/fredrik/librarybook.htm">http://www.pythonware.com/people/fredrik/librarybook.htm</a></blockquote>

<pre>-- 
Bill Barrington
CNN Interactive - <A HREF="http://cnn.com">http://cnn.com</A>
bill.barrington@cnn.com
404 827-5572</pre>
 </html>