B
Ben Sizer
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"!)
<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"!)