473,401 Members | 2,146 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,401 software developers and data experts.

PyCFunction_New requires a pointer to a static PyMethodDef?

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
0 1200

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Scott Deerwester | last post by:
Is it possible to create a Python-callable object, dynamically, in C/C++? I have a GUI app in C++, with the app logic in Python, called from the GUI via the Python C API. I need be able to call a...
0
by: Craig Ringer | last post by:
Hi folks I'm currently working on a fairly well internationalised app that embeds a Python intepreter. I'd like to make the docstrings translatable, but am running into the issue that the...
2
by: Brandon | last post by:
In a templated class I wrote, there is a public typedef for a function pointer. The class has an instance of the function pointer as a private member. That pointer is declared as static so I need...
3
by: John Ratliff | last post by:
When I dereference a pointer, does it make a copy of the object? Say I had a singleton, and wanted an static method to retrieve it from the class. class foo { private: static foo *bar; ...
3
by: boogie_down77 | last post by:
Is it possible to declare and initialize a static node pointer in C? I pass a node pointer in a function and I want to declare and initialize a static node pointer and initialize it to the head of...
1
by: Todd | last post by:
Hi, I'm working right from the example here to make a basic extenstion module. http://docs.python.org/ext/intro.html...
5
by: Amit_Basnak | last post by:
Dear Friends I have been getting the following error Error 185: "WorkFlow_dce.cpp", line 58 # Left side of '->' requires a pointer to class; type found was 'struct WF_SEARCH_WU'....
2
by: Dom Jackson | last post by:
Hello - I have a problem where I need to test some numeric code using a variety of built-in integer types: obj_type1 = obj_type2 OP obj_type3; // is obj_type1 correct? If I test with 10...
50
by: Juha Nieminen | last post by:
I asked a long time ago in this group how to make a smart pointer which works with incomplete types. I got this answer (only relevant parts included): ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.