Martin wrote: > So you merely want a proxy, not a weak proxy: both for the > entire object, and for the methods. So for this code, you > can save the proxy, and return your callable object. Make > the null pointer check in its tp_call slot, and don't kill > it after py func call, but merely clear the pointer. As you say, I need a proxy for my methods and a proxy for my objects. Creating my own proxy type for methods is easy, since the only interesting thing that must be proxied is __call__. Creating my own proxy type for arbitrary objects is harder because I must create a proxy for every slot that I use. That requires duplication a lot of the work that already lives in weakrefobject.c Also, for both method and object proxies, I have to invent a mechanism to signal that the original object is dead. weakrefobject.c already defines a nice mechanism. > I also notice that you rely on the fact that Python code has no way > to find out the underlying object of a weak proxy. I think this is a weak > assumption - there is no guarantee that this is not possible, or might > not be possible in the future. This is a concern. If I am mistaken in my assumption, please let me know and I will either invent my own proxy type or use the check-on-every-method-call technique. Cheers, Brian
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4