A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2002-February/019821.html below:

[Python-Dev] Extending types in C

[Python-Dev] Extending types in C - help needed [Python-Dev] Extending types in C - help neededThomas Heller thomas.heller@ion-tof.com
Wed, 6 Feb 2002 13:56:30 +0100
From: "Guido van Rossum" <guido@python.org>
> > Does this mean this is the wrong route, or is it absolute impossible
> > to create a subtype of PyType_Type in C with additional slots?
> 
> I wish I had time to explain this, but I don't.  For now, you'll have
> to read how types are initialized in typeobject.c -- maybe there's a
> way, maybe there isn't.
> 
> > Any tips about the route to take?
> 
> It can be done easily dynamically.
> 

I'm still struggling with this. How can it be done dynamically?

My idea would be to realloc() the object after creation, adding
a few bytes at the end. The problem is that I don't know how to
find out about the object size without knowledge about the internals.
The formula given in PEP 253
  type->tp_basicsize  +  nitems * type->tp_itemsize
seems not to be valid any more (at least with CYCLE GC).

Thomas




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