473,748 Members | 5,429 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

PyCFunction_New requires a pointer to a static PyMethodDef?

In following the example given at
<http://aspn.activestat e.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_Cal l.

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_Ca ll" 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 1212

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

Similar topics

3
4807
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 callback function in C/C++ from the Python, in response to an event (socket, whatever...) that the Python is aware of. Callbacks in Python, called from C/C++ are very straightforward, but I haven't been able to find any examples of the converse. ...
0
1254
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 translation function returns unicode data. Does anybody here know what encoding docstrings in PyMethodDef are interpreted as? Is there any sane way to get unicode data into docstrings for methods provided by extension modules?
2
4000
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 to declare an instance of the pointer. So, I tried using the keyword typename to declare the static member. I don't get any syntax errors but the pointer's name shows up in an "undefined symbol" error at compile time. Have a look at this...
3
3406
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; foo() {} // no public creation!
3
19796
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 the linked list. The last thing I do (or should I say, want to do)is to increment the static pointer. However I keep getting a compile error which complains that the initilizing value must be constant. How could this be? I don't get an error...
1
1663
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 http://www.dalkescientific.com/writings/diary/archive/2005/04/26/extending_python.html I can load my module into python and dir shows my function. But I get a syntax error if I try to access it.
5
3197
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'. lclStruct->wfWuHandle.workunitId =(long) feStruct->wfWuHandle- ^^^^^^^^ Error 185: "WorkFlow_dce.cpp", line 59 # Left side of '->' requires a pointer to class; type found was 'struct WF_SEARCH_WU'.
2
1894
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 built-in integer types, then I get 1000 permutations of the above statement. If I then test a dozen different operators, I get over 10,000 test operations.
50
4492
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): //------------------------------------------------------------------ template<typename Data_t> class SmartPointer { Data_t* data; void(*deleterFunc)(Data_t*);
0
8987
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8826
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9366
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9316
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6793
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6073
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
3303
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2777
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2211
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.