473,664 Members | 2,797 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Object finalization

Hi,
I have a question about Python object finalization. I would like to be notified when an Object is deallocated. The problem is I would like to do it in C.
The only way to register a finalizer I found out is to create a weak reference object and give it a callback. But the callback must be a Python function not C. That seems to be too difficult.

Is there any (undocumented) way to do PyObject_Regist erFinalizer(PyO bject *o, C-Callback-Func)?

Thanks a lot.

Best Regards,
Tobbi
Jul 18 '05 #1
0 1301

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

Similar topics

35
2117
by: MuZZy | last post by:
Hi All, I got a issue here and hope someone can help me: Let's consider this code: // =================== CODE START ================================= using System; using System.Data; namespace TestNamespace {
14
3143
by: MuZZy | last post by:
Hi, Lately i've been (and still am) fixing some memory leaks problems in the project i just took over when i got this new job. Among the other issues i've noticed that for localy created objects it makes difference to explicitly put them to null after working with them is done - it somehow makes the GC collect them sooner, like here: void SomeFunc() { MyClass c = new MyClass();
9
2075
by: Bruce | last post by:
How can I create a method that will take any object derived from a base class as a reference parameter? Something like this: void DestroyObject(ref BaseObject obj) { obj.Dispose(); obj = null; }
4
1799
by: Rick | last post by:
Hello, Below I create a static instance of an object, works well. public static BasicCounter GlobalCounter = new BasicCounter("GlobalCounter"); private void Page_Load(object sender, System.EventArgs e) { GlobalCounter.Increment();
9
1194
by: Rob Nicholson | last post by:
Is it possible to trap the creation of a new object and carry out other operations after it's been created? For example, if creating an object of a specific type, then add a reference to a global collection. Thanks, Rob.
6
1925
by: Brian Gideon | last post by:
How have you handled the finalization of thread-specific unmanaged resources? My question pertains specifically to using the DDEML which is a thread-specific API. In other words, every call to the API using the same handle must be made on the same thread as the one that obtained the handle. Obviously, there is a conflict with the GC and the finalizer thread in cases where the programmer forgets to call Dispose on a wrapper class.
9
1438
by: Steve Richter | last post by:
I understand the IDisposable interface and how the using instruction will call the Dispose method of an object. What if a reference to an object is passed to a 2nd thread? And the object contains a handle to an open file. The Dispose( ) method closes the handle. How would the Dispose( ) method called from the end of the using block in the 1st thread know that references to the object still exists in other threads?
20
13312
by: Justin Rich | last post by:
so im trying to be good and not leave anything hanging open but i guess ive seen a variety of ways to kill objects.. is there like a recommended way? basically im looking for best practices for handling object destruction. Thanks Justin
9
1260
by: Duggi | last post by:
I used to wonder why MS implemented C# to accept the following code using (Font f = new Font()) { // some code here. } While the same can be achieved through {
0
8437
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
8348
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
8778
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...
0
8636
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7375
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4185
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4351
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2003
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1759
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.