How to Copy a Dictionary from a C Extension?

Martin von Loewis loewis at informatik.hu-berlin.de
Tue Apr 18 13:08:31 EDT 2000


"Warren Postma" <embed at geocities.com> writes:

> Problem: If you want to copy the existing Globals used by the interpreter,
> what is the way to do this?  I found pydict_copy in dictobject.c, but it's
> static, so I can't invoke it directly.

I guess you can use PyObject_CallMethod, and give "copy" as the method
name. This is a couple of indirections more than needed, but should
work right away.

Regards,
Martin




More information about the Python-list mailing list