[Python-3000] C API changes? [Was: Python 3000 Process]
Neil Schemenauer
nas at arctrix.com
Tue Mar 21 20:08:40 CET 2006
On Tue, Mar 21, 2006 at 05:01:31PM +0100, Thomas Wouters wrote:
> I would like Pythonic code to be usable in both 2.x (where x is,
> say, 6 or higher) and 3.0, but 3.0 shouldn't need to worry too
> much about it.
The other question I haven't seen much discussion about is C API
changes. Are we hoping that people can port extension modules with
little effort or are we going to be doing lots of cleanup?
Some possible areas of cleanup:
* Use unions for PyObject structure (allowing strict aliasing
by the compiler).
* Move GC attributes into the PyObject structure (e.g. similar
to how ob_size works).
* Rethink weakref implementation (not sure about details but
maybe we can do better).
* Rationalize method structures (e.g. sq_concat and sq_repeat
could go away since we can use nb_add and nb_multiply).
* Rationalize finalizer behavior (e.g. get rid of __del__
methods in favor of guardians?).
* Make it easier to write simple extension types. For example,
there could be standard tp_clear and tp_traverse methods that
could work if the object is simply an array of PyObject pointers.
* Do we still need tp_print and tp_repr?
* Register instead of stack based VM?
One part of me hopes that we could do a lot of cleanup in these
areas. Another part is concerned about badly breaking the huge
number of extensions out there (a major reason for Python's success,
IMO). In any case, I hope an important objective of P3K will be to
make writing extensions even easier.
Neil
More information about the Python-3000
mailing list