By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,772 Members | 935 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,772 IT Pros & Developers. It's quick & easy.

PyCFunction_New requires a pointer to a static PyMethodDef?

P: n/a
In following the example given at
<http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/54352>, I find
that if I instead try to create PyMethodDef instances on the stack and
create methods that way, rather than providing pointers to a static
array of them, executing the method later raises an exception from
PyCFunction_Call.

Is it required that the PyMethodDef persists throughout the execution
of the Python program? If so, why isn't the information just copied
instead? I was hoping to just create a temporary PyMethodDef on the
stack purely for the duration of creating the method.

(Google doesn't find any instance of "PyCFunction_Call" on
docs.python.org. This might explain the Cookbook's comment that "one
hardly ever sees Python class objects built in C extensions"!)

--
Ben Sizer

Jan 9 '07 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.