[ZODB-Dev] subclassing Persistent in C
Nicholas Henke
henken at seas.upenn.edu
Thu May 1 19:28:35 EDT 2003
On Thu, 2003-05-01 at 14:22, Jeremy Hylton wrote:
>
> The example you extracted from your real code is incomplete, so it's
> hard to see what is really happening. (I don't know the ExtensionClass
> details very well, so it helps to see all the code.)
I am a bit confused there -- which code is incomplete -- the test.py or
PerWrap.c ?
>
> It's hard to guess what you want PerWrapper to do, so it's not clear
> what is wrong with it. For one thing, you haven't defined a tp_dealloc
> slot, so you can't actually create one.
I am hoping to use it as a drop-in replacement for Persistent that I can
add methods to for increasing performance.
Is there a proper way to subclass Persistent, instead of creating a new
type and using its CAPI methods? tp_dealloc is not one of those, and I
am not sure how I could use the methods defined in cPersistence.c -- or
for that matter if that is even appropriate.
>
> Python 2.3b1 (#131, Apr 28 2003, 12:20:49)
> [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-113)] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
> >>> import PerWrapper
> [49219 refs]
> >>> PerWrapper.PerWrapper()
> Traceback (most recent call last):
> File "<stdin>", line 1, in ?
> TypeError: Attempt to create instance of an abstract type
Yeah -- bit of a problem there.
Nic
--
Nicholas Henke
Penguin Herder & Linux Cluster System Programmer
Liniac Project - Univ. of Pennsylvania
More information about the ZODB-Dev
mailing list