Help: PyObject* questions
Gordon McMillan
gmcm at hypernet.com
Fri May 28 09:01:03 EDT 1999
Joseph Kuan asks:
> How do I make a carbon copy from a PyObject* ? Is there any
> built-in function to do that?
Nope. "Carbon copy" could mean any number of things. From
incrementing the ref count to doing a (careful) deep copy. A PyObject
may be self-contained, or the struct may have pointers to allocated
memory. All the same decisions you'd have to make in creating a copy
constructor in C++, but without any help from the language.
> When I call Py_BuildValue(....), is it true that the PyObject*
> returns with a reference counting of 1?
Yup. All the high level API calls are well behaved this way.
- Gordon
More information about the Python-list
mailing list